@wordpress/editor 14.8.8 → 14.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/bindings/api.js +0 -29
  3. package/build/bindings/api.js.map +1 -1
  4. package/build/components/autocompleters/user.js.map +1 -1
  5. package/build/components/block-manager/index.js +2 -2
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +15 -18
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  9. package/build/components/commands/index.js.map +1 -1
  10. package/build/components/create-template-part-modal/index.js.map +1 -1
  11. package/build/components/create-template-part-modal/utils.js.map +1 -1
  12. package/build/components/document-outline/index.js.map +1 -1
  13. package/build/components/document-outline/item.js.map +1 -1
  14. package/build/components/document-tools/index.js +2 -7
  15. package/build/components/document-tools/index.js.map +1 -1
  16. package/build/components/entities-saved-states/index.js +1 -1
  17. package/build/components/entities-saved-states/index.js.map +1 -1
  18. package/build/components/header/index.js +19 -16
  19. package/build/components/header/index.js.map +1 -1
  20. package/build/components/inserter-sidebar/index.js +8 -9
  21. package/build/components/inserter-sidebar/index.js.map +1 -1
  22. package/build/components/media-categories/index.js.map +1 -1
  23. package/build/components/page-attributes/parent.js +1 -1
  24. package/build/components/page-attributes/parent.js.map +1 -1
  25. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  26. package/build/components/post-actions/index.js.map +1 -1
  27. package/build/components/post-content-information/index.js +1 -1
  28. package/build/components/post-content-information/index.js.map +1 -1
  29. package/build/components/post-featured-image/index.js.map +1 -1
  30. package/build/components/post-format/index.js +1 -1
  31. package/build/components/post-format/index.js.map +1 -1
  32. package/build/components/post-last-revision/index.js +1 -1
  33. package/build/components/post-last-revision/index.js.map +1 -1
  34. package/build/components/post-locked-modal/index.js +2 -2
  35. package/build/components/post-locked-modal/index.js.map +1 -1
  36. package/build/components/post-preview-button/index.js +1 -1
  37. package/build/components/post-preview-button/index.js.map +1 -1
  38. package/build/components/post-publish-button/index.js.map +1 -1
  39. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  40. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  41. package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
  42. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  43. package/build/components/post-publish-panel/media-util.js +1 -0
  44. package/build/components/post-publish-panel/media-util.js.map +1 -1
  45. package/build/components/post-publish-panel/postpublish.js +1 -1
  46. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  47. package/build/components/post-schedule/label.js.map +1 -1
  48. package/build/components/post-taxonomies/flat-term-selector.js +4 -4
  49. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  50. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  51. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  52. package/build/components/post-taxonomies/index.js +1 -1
  53. package/build/components/post-taxonomies/index.js.map +1 -1
  54. package/build/components/post-taxonomies/panel.js.map +1 -1
  55. package/build/components/post-template/classic-theme.js +2 -4
  56. package/build/components/post-template/classic-theme.js.map +1 -1
  57. package/build/components/post-text-editor/index.js.map +1 -1
  58. package/build/components/post-title/index.js +15 -19
  59. package/build/components/post-title/index.js.map +1 -1
  60. package/build/components/post-title/index.native.js +2 -2
  61. package/build/components/post-title/index.native.js.map +1 -1
  62. package/build/components/post-url/index.js +76 -63
  63. package/build/components/post-url/index.js.map +1 -1
  64. package/build/components/post-url/panel.js +46 -26
  65. package/build/components/post-url/panel.js.map +1 -1
  66. package/build/components/post-visibility/index.js.map +1 -1
  67. package/build/components/preferences-modal/index.js.map +1 -1
  68. package/build/components/preview-dropdown/index.js.map +1 -1
  69. package/build/components/provider/disable-non-page-content-blocks.js +17 -18
  70. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  71. package/build/components/provider/index.js +1 -1
  72. package/build/components/provider/index.js.map +1 -1
  73. package/build/components/provider/use-post-content-blocks.js +34 -0
  74. package/build/components/provider/use-post-content-blocks.js.map +1 -0
  75. package/build/components/resizable-editor/resize-handle.js +4 -0
  76. package/build/components/resizable-editor/resize-handle.js.map +1 -1
  77. package/build/components/time-to-read/index.js +1 -1
  78. package/build/components/time-to-read/index.js.map +1 -1
  79. package/build/components/visual-editor/index.js.map +1 -1
  80. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  81. package/build/components/zoom-out-toggle/index.js +1 -1
  82. package/build/components/zoom-out-toggle/index.js.map +1 -1
  83. package/build/dataviews/actions/duplicate-template-part.js +1 -1
  84. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  85. package/build/dataviews/store/private-actions.js +2 -7
  86. package/build/dataviews/store/private-actions.js.map +1 -1
  87. package/build/private-apis.js +0 -1
  88. package/build/private-apis.js.map +1 -1
  89. package/build/store/actions.js +46 -6
  90. package/build/store/actions.js.map +1 -1
  91. package/build/store/constants.js +1 -0
  92. package/build/store/constants.js.map +1 -1
  93. package/build/store/local-autosave.js.map +1 -1
  94. package/build/store/private-actions.js +7 -6
  95. package/build/store/private-actions.js.map +1 -1
  96. package/build/store/private-selectors.js +3 -3
  97. package/build/store/private-selectors.js.map +1 -1
  98. package/build/store/selectors.js +21 -0
  99. package/build/store/selectors.js.map +1 -1
  100. package/build/utils/media-upload/index.js.map +1 -1
  101. package/build-module/bindings/api.js +1 -29
  102. package/build-module/bindings/api.js.map +1 -1
  103. package/build-module/components/autocompleters/user.js +1 -3
  104. package/build-module/components/autocompleters/user.js.map +1 -1
  105. package/build-module/components/block-manager/category.js +1 -2
  106. package/build-module/components/block-manager/category.js.map +1 -1
  107. package/build-module/components/block-manager/checklist.js +1 -2
  108. package/build-module/components/block-manager/checklist.js.map +1 -1
  109. package/build-module/components/block-manager/index.js +3 -4
  110. package/build-module/components/block-manager/index.js.map +1 -1
  111. package/build-module/components/block-settings-menu/content-only-settings-menu.js +15 -21
  112. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  113. package/build-module/components/blog-title/index.js +1 -3
  114. package/build-module/components/blog-title/index.js.map +1 -1
  115. package/build-module/components/collapsible-block-toolbar/index.js +1 -3
  116. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  117. package/build-module/components/commands/index.js.map +1 -1
  118. package/build-module/components/create-template-part-modal/index.js +1 -2
  119. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  120. package/build-module/components/create-template-part-modal/utils.js.map +1 -1
  121. package/build-module/components/document-bar/index.js +1 -2
  122. package/build-module/components/document-bar/index.js.map +1 -1
  123. package/build-module/components/document-outline/index.js +1 -2
  124. package/build-module/components/document-outline/index.js.map +1 -1
  125. package/build-module/components/document-outline/item.js +1 -2
  126. package/build-module/components/document-outline/item.js.map +1 -1
  127. package/build-module/components/document-tools/index.js +3 -10
  128. package/build-module/components/document-tools/index.js.map +1 -1
  129. package/build-module/components/editor/index.js +1 -3
  130. package/build-module/components/editor/index.js.map +1 -1
  131. package/build-module/components/editor-help/add-blocks.native.js +1 -3
  132. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  133. package/build-module/components/editor-help/customize-blocks.native.js +1 -3
  134. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  135. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
  136. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  137. package/build-module/components/editor-help/index.native.js +1 -3
  138. package/build-module/components/editor-help/index.native.js.map +1 -1
  139. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
  140. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  141. package/build-module/components/editor-help/move-blocks.native.js +1 -3
  142. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  143. package/build-module/components/editor-help/remove-blocks.native.js +1 -3
  144. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  145. package/build-module/components/editor-help/view-sections.native.js +1 -2
  146. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  147. package/build-module/components/editor-interface/index.js +1 -3
  148. package/build-module/components/editor-interface/index.js.map +1 -1
  149. package/build-module/components/editor-notices/index.js +1 -3
  150. package/build-module/components/editor-notices/index.js.map +1 -1
  151. package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
  152. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  153. package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
  154. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  155. package/build-module/components/entities-saved-states/index.js +2 -3
  156. package/build-module/components/entities-saved-states/index.js.map +1 -1
  157. package/build-module/components/error-boundary/index.native.js +1 -2
  158. package/build-module/components/error-boundary/index.native.js.map +1 -1
  159. package/build-module/components/header/index.js +20 -18
  160. package/build-module/components/header/index.js.map +1 -1
  161. package/build-module/components/inserter-sidebar/index.js +8 -9
  162. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  163. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  164. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  165. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
  166. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  167. package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
  168. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  169. package/build-module/components/media-categories/index.js.map +1 -1
  170. package/build-module/components/more-menu/index.js +1 -3
  171. package/build-module/components/more-menu/index.js.map +1 -1
  172. package/build-module/components/offline-status/index.native.js +1 -2
  173. package/build-module/components/offline-status/index.native.js.map +1 -1
  174. package/build-module/components/page-attributes/parent.js +2 -3
  175. package/build-module/components/page-attributes/parent.js.map +1 -1
  176. package/build-module/components/plugin-document-setting-panel/index.js +1 -3
  177. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  178. package/build-module/components/post-actions/index.js +1 -3
  179. package/build-module/components/post-actions/index.js.map +1 -1
  180. package/build-module/components/post-author/panel.js +1 -2
  181. package/build-module/components/post-author/panel.js.map +1 -1
  182. package/build-module/components/post-card-panel/index.js +1 -2
  183. package/build-module/components/post-card-panel/index.js.map +1 -1
  184. package/build-module/components/post-content-information/index.js +1 -1
  185. package/build-module/components/post-content-information/index.js.map +1 -1
  186. package/build-module/components/post-discussion/panel.js +1 -2
  187. package/build-module/components/post-discussion/panel.js.map +1 -1
  188. package/build-module/components/post-excerpt/panel.js +1 -3
  189. package/build-module/components/post-excerpt/panel.js.map +1 -1
  190. package/build-module/components/post-featured-image/index.js +1 -2
  191. package/build-module/components/post-featured-image/index.js.map +1 -1
  192. package/build-module/components/post-format/index.js +2 -3
  193. package/build-module/components/post-format/index.js.map +1 -1
  194. package/build-module/components/post-format/panel.js +1 -2
  195. package/build-module/components/post-format/panel.js.map +1 -1
  196. package/build-module/components/post-last-revision/index.js +1 -1
  197. package/build-module/components/post-last-revision/index.js.map +1 -1
  198. package/build-module/components/post-locked-modal/index.js +3 -5
  199. package/build-module/components/post-locked-modal/index.js.map +1 -1
  200. package/build-module/components/post-panel-row/index.js +1 -2
  201. package/build-module/components/post-panel-row/index.js.map +1 -1
  202. package/build-module/components/post-preview-button/index.js +2 -4
  203. package/build-module/components/post-preview-button/index.js.map +1 -1
  204. package/build-module/components/post-publish-button/index.js +1 -2
  205. package/build-module/components/post-publish-button/index.js.map +1 -1
  206. package/build-module/components/post-publish-panel/index.js +1 -3
  207. package/build-module/components/post-publish-panel/index.js.map +1 -1
  208. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
  209. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  210. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  211. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  212. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
  213. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  214. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
  215. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  216. package/build-module/components/post-publish-panel/media-util.js +1 -0
  217. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  218. package/build-module/components/post-publish-panel/postpublish.js +2 -4
  219. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  220. package/build-module/components/post-publish-panel/prepublish.js +1 -3
  221. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  222. package/build-module/components/post-saved-state/index.js +1 -2
  223. package/build-module/components/post-saved-state/index.js.map +1 -1
  224. package/build-module/components/post-schedule/label.js.map +1 -1
  225. package/build-module/components/post-status/index.js +1 -3
  226. package/build-module/components/post-status/index.js.map +1 -1
  227. package/build-module/components/post-switch-to-draft-button/index.js +1 -3
  228. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  229. package/build-module/components/post-taxonomies/flat-term-selector.js +5 -7
  230. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  231. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
  232. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  233. package/build-module/components/post-taxonomies/index.js +1 -1
  234. package/build-module/components/post-taxonomies/index.js.map +1 -1
  235. package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
  236. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  237. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  238. package/build-module/components/post-template/block-theme.js +1 -3
  239. package/build-module/components/post-template/block-theme.js.map +1 -1
  240. package/build-module/components/post-template/classic-theme.js +3 -6
  241. package/build-module/components/post-template/classic-theme.js.map +1 -1
  242. package/build-module/components/post-template/create-new-template-modal.js +1 -2
  243. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  244. package/build-module/components/post-template/create-new-template.js +1 -3
  245. package/build-module/components/post-template/create-new-template.js.map +1 -1
  246. package/build-module/components/post-template/swap-template-button.js +1 -3
  247. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  248. package/build-module/components/post-text-editor/index.js +1 -3
  249. package/build-module/components/post-text-editor/index.js.map +1 -1
  250. package/build-module/components/post-title/index.js +15 -19
  251. package/build-module/components/post-title/index.js.map +1 -1
  252. package/build-module/components/post-title/index.native.js +2 -2
  253. package/build-module/components/post-title/index.native.js.map +1 -1
  254. package/build-module/components/post-trash/index.js +1 -2
  255. package/build-module/components/post-trash/index.js.map +1 -1
  256. package/build-module/components/post-url/index.js +78 -66
  257. package/build-module/components/post-url/index.js.map +1 -1
  258. package/build-module/components/post-url/panel.js +48 -28
  259. package/build-module/components/post-url/panel.js.map +1 -1
  260. package/build-module/components/post-visibility/index.js +1 -2
  261. package/build-module/components/post-visibility/index.js.map +1 -1
  262. package/build-module/components/posts-per-page/index.js +1 -3
  263. package/build-module/components/posts-per-page/index.js.map +1 -1
  264. package/build-module/components/preferences-modal/index.js +1 -3
  265. package/build-module/components/preferences-modal/index.js.map +1 -1
  266. package/build-module/components/preview-dropdown/index.js +1 -3
  267. package/build-module/components/preview-dropdown/index.js.map +1 -1
  268. package/build-module/components/provider/disable-non-page-content-blocks.js +17 -18
  269. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  270. package/build-module/components/provider/index.js +2 -4
  271. package/build-module/components/provider/index.js.map +1 -1
  272. package/build-module/components/provider/index.native.js +1 -3
  273. package/build-module/components/provider/index.native.js.map +1 -1
  274. package/build-module/components/provider/use-post-content-blocks.js +27 -0
  275. package/build-module/components/provider/use-post-content-blocks.js.map +1 -0
  276. package/build-module/components/resizable-editor/resize-handle.js +5 -3
  277. package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
  278. package/build-module/components/save-publish-panels/index.js +1 -3
  279. package/build-module/components/save-publish-panels/index.js.map +1 -1
  280. package/build-module/components/sidebar/header.js +1 -2
  281. package/build-module/components/sidebar/header.js.map +1 -1
  282. package/build-module/components/sidebar/index.js +1 -2
  283. package/build-module/components/sidebar/index.js.map +1 -1
  284. package/build-module/components/sidebar/post-summary.js +1 -3
  285. package/build-module/components/sidebar/post-summary.js.map +1 -1
  286. package/build-module/components/site-discussion/index.js +1 -3
  287. package/build-module/components/site-discussion/index.js.map +1 -1
  288. package/build-module/components/start-template-options/index.js +1 -2
  289. package/build-module/components/start-template-options/index.js.map +1 -1
  290. package/build-module/components/table-of-contents/panel.js +1 -3
  291. package/build-module/components/table-of-contents/panel.js.map +1 -1
  292. package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
  293. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
  294. package/build-module/components/template-validation-notice/index.js +1 -3
  295. package/build-module/components/template-validation-notice/index.js.map +1 -1
  296. package/build-module/components/text-editor/index.js +1 -2
  297. package/build-module/components/text-editor/index.js.map +1 -1
  298. package/build-module/components/time-to-read/index.js +1 -1
  299. package/build-module/components/time-to-read/index.js.map +1 -1
  300. package/build-module/components/visual-editor/index.js +1 -3
  301. package/build-module/components/visual-editor/index.js.map +1 -1
  302. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  303. package/build-module/components/zoom-out-toggle/index.js +1 -1
  304. package/build-module/components/zoom-out-toggle/index.js.map +1 -1
  305. package/build-module/dataviews/actions/duplicate-template-part.js +1 -1
  306. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  307. package/build-module/dataviews/store/private-actions.js +4 -8
  308. package/build-module/dataviews/store/private-actions.js.map +1 -1
  309. package/build-module/hooks/pattern-overrides.js +1 -3
  310. package/build-module/hooks/pattern-overrides.js.map +1 -1
  311. package/build-module/private-apis.js +1 -2
  312. package/build-module/private-apis.js.map +1 -1
  313. package/build-module/store/actions.js +44 -6
  314. package/build-module/store/actions.js.map +1 -1
  315. package/build-module/store/constants.js +1 -0
  316. package/build-module/store/constants.js.map +1 -1
  317. package/build-module/store/local-autosave.js.map +1 -1
  318. package/build-module/store/private-actions.js +7 -6
  319. package/build-module/store/private-actions.js.map +1 -1
  320. package/build-module/store/private-selectors.js +2 -2
  321. package/build-module/store/private-selectors.js.map +1 -1
  322. package/build-module/store/selectors.js +21 -0
  323. package/build-module/store/selectors.js.map +1 -1
  324. package/build-module/utils/media-upload/index.js.map +1 -1
  325. package/build-style/style-rtl.css +29 -6
  326. package/build-style/style.css +29 -6
  327. package/build-types/bindings/api.d.ts +0 -13
  328. package/build-types/bindings/api.d.ts.map +1 -1
  329. package/build-types/components/document-tools/index.d.ts.map +1 -1
  330. package/build-types/components/header/index.d.ts.map +1 -1
  331. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  332. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  333. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  334. package/build-types/components/post-url/index.d.ts.map +1 -1
  335. package/build-types/components/post-url/panel.d.ts.map +1 -1
  336. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  337. package/build-types/components/provider/index.d.ts.map +1 -1
  338. package/build-types/components/provider/use-post-content-blocks.d.ts +2 -0
  339. package/build-types/components/provider/use-post-content-blocks.d.ts.map +1 -0
  340. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  341. package/build-types/private-apis.d.ts.map +1 -1
  342. package/build-types/store/actions.d.ts +2 -17
  343. package/build-types/store/actions.d.ts.map +1 -1
  344. package/build-types/store/private-selectors.d.ts +2 -2
  345. package/build-types/store/private-selectors.d.ts.map +1 -1
  346. package/build-types/store/selectors.d.ts +21 -0
  347. package/build-types/store/selectors.d.ts.map +1 -1
  348. package/package.json +38 -38
  349. package/src/bindings/api.js +1 -32
  350. package/src/components/block-settings-menu/content-only-settings-menu.js +19 -19
  351. package/src/components/document-tools/index.js +2 -5
  352. package/src/components/header/index.js +24 -13
  353. package/src/components/inserter-sidebar/index.js +8 -11
  354. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  355. package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  356. package/src/components/post-template/classic-theme.js +1 -2
  357. package/src/components/post-url/index.js +67 -55
  358. package/src/components/post-url/panel.js +57 -33
  359. package/src/components/post-url/style.scss +21 -3
  360. package/src/components/provider/disable-non-page-content-blocks.js +20 -34
  361. package/src/components/provider/index.js +1 -0
  362. package/src/components/provider/use-post-content-blocks.js +42 -0
  363. package/src/components/resizable-editor/resize-handle.js +5 -0
  364. package/src/components/zoom-out-toggle/index.js +1 -1
  365. package/src/dataviews/store/private-actions.ts +7 -7
  366. package/src/private-apis.js +1 -5
  367. package/src/store/actions.js +51 -7
  368. package/src/store/private-selectors.js +2 -2
  369. package/src/store/selectors.js +21 -0
  370. package/src/store/test/actions.js +76 -0
  371. package/src/store/test/reducer.js +0 -22
  372. package/tsconfig.tsbuildinfo +1 -1
  373. package/build/dataviews/actions/delete-post.js +0 -98
  374. package/build/dataviews/actions/delete-post.js.map +0 -1
  375. package/build/dataviews/actions/rename-post.js +0 -125
  376. package/build/dataviews/actions/rename-post.js.map +0 -1
  377. package/build/dataviews/actions/reset-post.js +0 -113
  378. package/build/dataviews/actions/reset-post.js.map +0 -1
  379. package/build/dataviews/actions/restore-post.js +0 -112
  380. package/build/dataviews/actions/restore-post.js.map +0 -1
  381. package/build/dataviews/actions/trash-post.js +0 -144
  382. package/build/dataviews/actions/trash-post.js.map +0 -1
  383. package/build/dataviews/fields/index.js +0 -32
  384. package/build/dataviews/fields/index.js.map +0 -1
  385. package/build-module/dataviews/actions/delete-post.js +0 -89
  386. package/build-module/dataviews/actions/delete-post.js.map +0 -1
  387. package/build-module/dataviews/actions/rename-post.js +0 -118
  388. package/build-module/dataviews/actions/rename-post.js.map +0 -1
  389. package/build-module/dataviews/actions/reset-post.js +0 -106
  390. package/build-module/dataviews/actions/reset-post.js.map +0 -1
  391. package/build-module/dataviews/actions/restore-post.js +0 -104
  392. package/build-module/dataviews/actions/restore-post.js.map +0 -1
  393. package/build-module/dataviews/actions/trash-post.js +0 -137
  394. package/build-module/dataviews/actions/trash-post.js.map +0 -1
  395. package/build-module/dataviews/fields/index.js +0 -26
  396. package/build-module/dataviews/fields/index.js.map +0 -1
  397. package/build-types/dataviews/actions/delete-post.d.ts +0 -5
  398. package/build-types/dataviews/actions/delete-post.d.ts.map +0 -1
  399. package/build-types/dataviews/actions/rename-post.d.ts +0 -5
  400. package/build-types/dataviews/actions/rename-post.d.ts.map +0 -1
  401. package/build-types/dataviews/actions/reset-post.d.ts +0 -5
  402. package/build-types/dataviews/actions/reset-post.d.ts.map +0 -1
  403. package/build-types/dataviews/actions/restore-post.d.ts +0 -5
  404. package/build-types/dataviews/actions/restore-post.d.ts.map +0 -1
  405. package/build-types/dataviews/actions/trash-post.d.ts +0 -5
  406. package/build-types/dataviews/actions/trash-post.d.ts.map +0 -1
  407. package/build-types/dataviews/fields/index.d.ts +0 -8
  408. package/build-types/dataviews/fields/index.d.ts.map +0 -1
  409. package/src/dataviews/actions/delete-post.tsx +0 -109
  410. package/src/dataviews/actions/rename-post.tsx +0 -146
  411. package/src/dataviews/actions/reset-post.tsx +0 -147
  412. package/src/dataviews/actions/restore-post.tsx +0 -134
  413. package/src/dataviews/actions/trash-post.tsx +0 -198
  414. package/src/dataviews/fields/index.ts +0 -26
@@ -1 +1 @@
1
- {"version":3,"names":["createSlotFill","PanelBody","usePluginContext","useDispatch","useSelect","warning","EnablePluginDocumentSettingPanelOption","store","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","panelName","opened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","undefined","globalThis","SCRIPT_DEBUG","label","onToggle"],"sources":["@wordpress/editor/src/components/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport EnablePluginDocumentSettingPanelOption from '../preferences-modal/enable-plugin-document-setting-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/editor';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,sCAAsC,MAAM,2DAA2D;AAC9G,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAM;EAAEC,IAA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,iBACVhB,IAAA,CAACT,SAAS;QACTkB,SAAS,EAAGA,SAAW;QACvBC,KAAK,EAAGA,KAAO;QACfC,IAAI,EAAGA,IAAM;QACbI,MAAM,EAAGA,MAAQ;QACjBU,QAAQ,EAAGA,CAAA,KAAML,uBAAuB,CAAEN,SAAU,CAAG;QAAAF,QAAA,EAErDA;MAAQ,CACA;IACX,CACI,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAEDL,0BAA0B,CAACD,IAAI,GAAGA,IAAI;AAEtC,eAAeC,0BAA0B","ignoreList":[]}
1
+ {"version":3,"names":["createSlotFill","PanelBody","usePluginContext","useDispatch","useSelect","warning","EnablePluginDocumentSettingPanelOption","store","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","panelName","opened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","undefined","globalThis","SCRIPT_DEBUG","label","onToggle"],"sources":["@wordpress/editor/src/components/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport EnablePluginDocumentSettingPanelOption from '../preferences-modal/enable-plugin-document-setting-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/editor';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,sCAAsC,MAAM,2DAA2D;AAC9G,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGhB,cAAc,CAAE,4BAA6B,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMiB,0BAA0B,GAAGA,CAAE;EACpCC,IAAI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,7 @@ import { store as coreStore } from '@wordpress/core-data';
13
13
  */
14
14
  import { unlock } from '../../lock-unlock';
15
15
  import { usePostActions } from './actions';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
19
17
  const {
20
18
  DropdownMenuV2,
21
19
  kebabCase
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","kebabCase","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","item","permissions","select","getEditedEntityRecord","getEntityRecordPermissions","itemWithPermissions","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenuV2>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuV2.Item\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>\n\t\t</DropdownMenuV2.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuV2.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuV2.Group>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3C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ACzCD,OAAO,EAAGA;QAAS,GAJbhB,MAAM,CAACkC,EAKb,CAAC;MAEJ;MACA,oBACCxD,IAAA,CAACuC,uBAAuB;QAEvBjB,MAAM,EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACuC,QAAQ,CAAE,CAAEhD,IAAI,CAAG,CAAG;QAC7C2B,KAAK,EAAG,CAAE3B,IAAI;MAAI,GAHZS,MAAM,CAACkC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACkB,CAAC;AAEzB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","kebabCase","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","item","permissions","select","getEditedEntityRecord","getEntityRecordPermissions","itemWithPermissions","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenuV2>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuV2.Item\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>\n\t\t</DropdownMenuV2.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuV2.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuV2.Group>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA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Aa,EAAGP,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbhB,MAAM,CAACkC,EAKb,CAAC;MAEJ;MACA,oBACCxD,IAAA,CAACuC,uBAAuB;QAEvBjB,MAAM,EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACuC,QAAQ,CAAE,CAAEhD,IAAI,CAAG,CAAG;QAC7C2B,KAAK,EAAG,CAAE3B,IAAI;MAAI,GAHZS,MAAM,CAACkC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACkB,CAAC;AAEzB","ignoreList":[]}
@@ -14,8 +14,7 @@ import PostAuthorCheck from './check';
14
14
  import PostAuthorForm from './index';
15
15
  import PostPanelRow from '../post-panel-row';
16
16
  import { useAuthorsQuery } from './hook';
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
18
  function PostAuthorToggle({
20
19
  isOpen,
21
20
  onClick
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Button","Dropdown","useState","useMemo","decodeEntities","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","PostAuthorCheck","PostAuthorForm","PostPanelRow","useAuthorsQuery","jsx","_jsx","jsxs","_jsxs","PostAuthorToggle","isOpen","onClick","postAuthor","authorName","name","size","className","variant","children","PostAuthor","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","label","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","title"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change author: %s' ), authorName ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ authorName }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow label={ __( 'Author' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-author__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostAuthorToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-author\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostAuthorForm onClose={ onClose } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,eAAe,QAAQ,QAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzC,SAASC,gBAAgBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAChD,MAAM;IAAEC;EAAW,CAAC,GAAGR,eAAe,CAAC,CAAC;EACxC,MAAMS,UAAU,GACff,cAAc,CAAEc,UAAU,EAAEE,IAAK,CAAC,IAAItB,EAAE,CAAE,aAAc,CAAC;EAC1D,oBACCc,IAAA,CAACZ,MAAM;IACNqB,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,kCAAkC;IAC5CC,OAAO,EAAC,UAAU;IAClB,iBAAgBP;IAChB;IAAA;IACA,cAAajB,OAAO,CAAED,EAAE,CAAE,mBAAoB,CAAC,EAAEqB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1
+ {"version":3,"names":["__","sprintf","Button","Dropdown","useState","useMemo","decodeEntities","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","PostAuthorCheck","PostAuthorForm","PostPanelRow","useAuthorsQuery","jsx","_jsx","jsxs","_jsxs","PostAuthorToggle","isOpen","onClick","postAuthor","authorName","name","size","className","variant","children","PostAuthor","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","label","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","title"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change author: %s' ), authorName ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ authorName }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow label={ __( 'Author' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-author__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostAuthorToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-author\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostAuthorForm onClose={ onClose } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;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;QAC7BO,gBAAgB,EAAC,kCAAkC;QACnDC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAErB,MAAM;UAAEsB;QAAS,CAAC,kBACpC1B,IAAA,CAACG,gBAAgB;UAChBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAGqB;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAEC;QAAQ,CAAC,kBAC5B1B,KAAA;UAAKQ,SAAS,EAAC,oBAAoB;UAAAE,QAAA,gBAClCZ,IAAA,CAACN,sBAAsB;YACtBmC,KAAK,EAAG3C,EAAE,CAAE,QAAS,CAAG;YACxB0C,OAAO,EAAGA;UAAS,CACnB,CAAC,eACF5B,IAAA,CAACJ,cAAc;YAACgC,OAAO,EAAGA;UAAS,CAAE,CAAC;QAAA,CAClC;MACH,CACH;IAAC,CACW;EAAC,CACC,CAAC;AAEpB;AAEA,eAAef,UAAU","ignoreList":[]}
@@ -18,8 +18,7 @@ import { store as editorStore } from '../../store';
18
18
  import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, GLOBAL_POST_TYPES } from '../../store/constants';
19
19
  import { unlock } from '../../lock-unlock';
20
20
  import PostActions from '../post-actions';
21
- import { jsx as _jsx } from "react/jsx-runtime";
22
- import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
22
  export default function PostCardPanel({
24
23
  postType,
25
24
  postId,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","PostActions","jsx","_jsx","jsxs","_jsxs","PostCardPanel","postType","postId","onActionPerformed","isFrontPage","isPostsPage","title","icon","isSync","select","__experimentalGetTemplateInfo","canUser","getEditedEntityRecord","siteSettings","kind","name","undefined","_record","_templateInfo","includes","_isSync","currentSyncStatus","meta","wp_pattern_sync_status","getPostIcon","area","page_on_front","page_for_posts","className","children","spacing","align","numberOfLines","truncate","weight","as","lineHeight"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { canUser, getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\tpostType\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( postType ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === postType ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\t_record?.meta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: _record?.wp_pattern_sync_status;\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttitle: _templateInfo?.title || _record?.title,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === postId,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === postId,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<PostActions\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE1C,eAAe,SAASC,aAAaA,CAAE;EACtCC,QAAQ;EACRC,MAAM;EACNC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,WAAW;IAAEC,KAAK;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGtB,SAAS,CAChEuB,MAAM,IAAM;IACb,MAAM;MAAEC;IAA8B,CAAC,GAAGD,MAAM,CAAEpB,WAAY,CAAC;I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,CACnB,CAAC;EACD,oBACCJ,IAAA;IAAK+B,SAAS,EAAC,wBAAwB;IAAAC,QAAA,eACtC9B,KAAA,CAAClB,MAAM;MACNiD,OAAO,EAAG,CAAG;MACbF,SAAS,EAAC,gCAAgC;MAC1CG,KAAK,EAAC,YAAY;MAAAF,QAAA,gBAElBhC,IAAA,CAAClB,IAAI;QACJiD,SAAS,EAAGlD,IAAI,CAAE,8BAA8B,EAAE;UACjD,SAAS,EAAE8B;QACZ,CAAE,CAAG;QACLD,IAAI,EAAGA;MAAM,CACb,CAAC,eACFR,KAAA,CAAChB,IAAI;QACJiD,aAAa,EAAG,CAAG;QACnBC,QAAQ;QACRL,SAAS,EAAC,+BAA+B;QACzCM,MAAM,EAAG,GAAK;QACdC,EAAE,EAAC,IAAI;QACPC,UAAU,EAAC,MAAM;QAAAP,QAAA,GAEfvB,KAAK,GAAGlB,cAAc,CAAEkB,KAAM,CAAC,GAAGnB,EAAE,CAAE,UAAW,CAAC,EAClDiB,WAAW,iBACZP,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,UAAW;QAAC,CACb,CACN,EACCkB,WAAW,iBACZR,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,YAAa;QAAC,CACf,CACN;MAAA,CACI,CAAC,eACPU,IAAA,CAACF,WAAW;QACXM,QAAQ,EAAGA,QAAU;QACrBC,MAAM,EAAGA,MAAQ;QACjBC,iBAAiB,EAAGA;MAAmB,CACvC,CAAC;IAAA,CACK;EAAC,CACL,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","PostActions","jsx","_jsx","jsxs","_jsxs","PostCardPanel","postType","postId","onActionPerformed","isFrontPage","isPostsPage","title","icon","isSync","select","__experimentalGetTemplateInfo","canUser","getEditedEntityRecord","siteSettings","kind","name","undefined","_record","_templateInfo","includes","_isSync","currentSyncStatus","meta","wp_pattern_sync_status","getPostIcon","area","page_on_front","page_for_posts","className","children","spacing","align","numberOfLines","truncate","weight","as","lineHeight"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { canUser, getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\tpostType\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( postType ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === postType ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\t_record?.meta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: _record?.wp_pattern_sync_status;\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttitle: _templateInfo?.title || _record?.title,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === postId,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === postId,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<PostActions\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1C,eAAe,SAASC,aAAaA,CAAE;EACtCC,QAAQ;EACRC,MAAM;EACNC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,WAAW;IAAEC,KAAK;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGtB,SAAS,CAChEuB,MAA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EAAEc,cAAc,KAAKzB;IAC/C,CAAC;EACF,CAAC,EACD,CAAEA,MAAM,EAAED,QAAQ,CACnB,CAAC;EACD,oBACCJ,IAAA;IAAK+B,SAAS,EAAC,wBAAwB;IAAAC,QAAA,eACtC9B,KAAA,CAAClB,MAAM;MACNiD,OAAO,EAAG,CAAG;MACbF,SAAS,EAAC,gCAAgC;MAC1CG,KAAK,EAAC,YAAY;MAAAF,QAAA,gBAElBhC,IAAA,CAAClB,IAAI;QACJiD,SAAS,EAAGlD,IAAI,CAAE,8BAA8B,EAAE;UACjD,SAAS,EAAE8B;QACZ,CAAE,CAAG;QACLD,IAAI,EAAGA;MAAM,CACb,CAAC,eACFR,KAAA,CAAChB,IAAI;QACJiD,aAAa,EAAG,CAAG;QACnBC,QAAQ;QACRL,SAAS,EAAC,+BAA+B;QACzCM,MAAM,EAAG,GAAK;QACdC,EAAE,EAAC,IAAI;QACPC,UAAU,EAAC,MAAM;QAAAP,QAAA,GAEfvB,KAAK,GAAGlB,cAAc,CAAEkB,KAAM,CAAC,GAAGnB,EAAE,CAAE,UAAW,CAAC,EAClDiB,WAAW,iBACZP,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,UAAW;QAAC,CACb,CACN,EACCkB,WAAW,iBACZR,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,YAAa;QAAC,CACf,CACN;MAAA,CACI,CAAC,eACPU,IAAA,CAACF,WAAW;QACXM,QAAQ,EAAGA,QAAU;QACrBC,MAAM,EAAGA,MAAQ;QACjBC,iBAAiB,EAAGA;MAAmB,CACvC,CAAC;IAAA,CACK;EAAC,CACL,CAAC;AAER","ignoreList":[]}
@@ -67,7 +67,7 @@ export default function PostContentInformation() {
67
67
  return /*#__PURE__*/_jsx("div", {
68
68
  className: "editor-post-content-information",
69
69
  children: /*#__PURE__*/_jsx(Text, {
70
- children: sprintf( /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
70
+ children: sprintf(/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
71
71
  __('%1$s, %2$s read time.'), wordsCountText, minutesText)
72
72
  })
73
73
  });
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalText","Text","useSelect","__","_x","_n","sprintf","count","wordCount","useMemo","store","coreStore","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","jsx","_jsx","AVERAGE_READING_RATE","PostContentInformation","postContent","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","canUser","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","includes","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText","className","children"],"sources":["@wordpress/editor/src/components/post-content-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: the number of minutes to read the post.\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"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C,uBAAuB,CAAE,CAACqB,QAAQ,CACzDL,QACD,CAAC;IACF,OAAO;MACNX,WAAW,EACVe,mBAAmB,IAAIb,sBAAsB,CAAE,SAAU;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;AACD;AACA;AACA;AACA;EACC,MAAMe,aAAa,GAAGhC,EAAE,CAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMiC,YAAY,GAAG5B,OAAO,CAC3B,MAAQU,WAAW,GAAGX,SAAS,CAAEW,WAAW,EAAEiB,aAAc,CAAC,GAAG,CAAG,EACnE,CAAEjB,WAAW,EAAEiB,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEC,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEH,YAAY,GAAGpB,oBAAqB,CAAC;EACrE,MAAMwB,cAAc,GAAGnC,OAAO;EAC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEgC,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACbnC,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAEiC,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,oBACC1B,IAAA;IAAK4B,SAAS,EAAC,iCAAiC;IAAAC,QAAA,eAC/C7B,IAAA,CAACf,IAAI;MAAA4C,QAAA,EACFvC,OAAO,EACR;MACAH,EAAE,CAAE,uBAAwB,CAAC,EAC7BsC,cAAc,EACdE,WACD;IAAC,CACI;EAAC,CACH,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalText","Text","useSelect","__","_x","_n","sprintf","count","wordCount","useMemo","store","coreStore","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","jsx","_jsx","AVERAGE_READING_RATE","PostContentInformation","postContent","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","canUser","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","includes","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText","className","children"],"sources":["@wordpress/editor/src/components/post-content-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: the number of minutes to read the post.\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAE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S,CAAEW,WAAW,EAAEiB,aAAc,CAAC,GAAG,CAAG,EACnE,CAAEjB,WAAW,EAAEiB,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEC,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEH,YAAY,GAAGpB,oBAAqB,CAAC;EACrE,MAAMwB,cAAc,GAAGnC,OAAO;EAC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEgC,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACbnC,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAEiC,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,oBACC1B,IAAA;IAAK4B,SAAS,EAAC,iCAAiC;IAAAC,QAAA,eAC/C7B,IAAA,CAACf,IAAI;MAAA4C,QAAA,EACFvC,OAAO,CACR;MACAH,EAAE,CAAE,uBAAwB,CAAC,EAC7BsC,cAAc,EACdE,WACD;IAAC,CACI;EAAC,CACH,CAAC;AAER","ignoreList":[]}
@@ -16,8 +16,7 @@ import PostTypeSupportCheck from '../post-type-support-check';
16
16
  import PostComments from '../post-comments';
17
17
  import PostPingbacks from '../post-pingbacks';
18
18
  import PostPanelRow from '../post-panel-row';
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
20
  const PANEL_NAME = 'discussion-panel';
22
21
  function ModalContents({
23
22
  onClose
@@ -1 +1 @@
1
- {"version":3,"names":["__","_x","Dropdown","Button","__experimentalVStack","VStack","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PostPanelRow","jsx","_jsx","jsxs","_jsxs","PANEL_NAME","ModalContents","onClose","className","children","title","spacing","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","getPostType","postType","supports","comments","trackbacks","label","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\nimport PostPanelRow from '../post-panel-row';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction ModalContents( { onClose } ) {\n\treturn (\n\t\t<div className=\"editor-post-discussion\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction PostDiscussionToggle( { isOpen, onClick } ) {\n\tconst {\n\t\tcommentStatus,\n\t\tpingStatus,\n\t\tcommentsSupported,\n\t\ttrackbacksSupported,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tcommentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',\n\t\t\tpingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',\n\t\t\tcommentsSupported: !! postType.supports.comments,\n\t\t\ttrackbacksSupported: !! postType.supports.trackbacks,\n\t\t};\n\t}, [] );\n\tlet label;\n\tif ( commentStatus === 'open' ) {\n\t\tif ( pingStatus === 'open' ) {\n\t\t\tlabel = _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t} else {\n\t\t\tlabel = trackbacksSupported\n\t\t\t\t? __( 'Comments only' )\n\t\t\t\t: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t}\n\t} else if ( pingStatus === 'open' ) {\n\t\tlabel = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );\n\t} else {\n\t\tlabel = __( 'Closed' );\n\t}\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-discussion__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ __( 'Change discussion options' ) }\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\n/**\n * This component allows to update comment and pingback\n * settings for the current post. Internally there are\n * checks whether the current post has support for the\n * above and if the `discussion-panel` panel is enabled.\n *\n * @return {JSX.Element|null} The rendered PostDiscussionPanel component.\n */\nexport default function PostDiscussionPanel() {\n\tconst { isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled } = select( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-discussion__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-discussion__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostDiscussionToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<ModalContents onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ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QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAExC;QAAQ,CAAC,kBAC5BL,IAAA,CAACI,aAAa;UAACC,OAAO,EAAGA;QAAS,CAAE;MAClC,CACH;IAAC,CACW;EAAC,CACM,CAAC;AAEzB","ignoreList":[]}
1
+ {"version":3,"names":["__","_x","Dropdown","Button","__experimentalVStack","VStack","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PostPanelRow","jsx","_jsx","jsxs","_jsxs","PANEL_NAME","ModalContents","onClose","className","children","title","spacing","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","getPostType","postType","supports","comments","trackbacks","label","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\nimport PostPanelRow from '../post-panel-row';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction ModalContents( { onClose } ) {\n\treturn (\n\t\t<div className=\"editor-post-discussion\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction PostDiscussionToggle( { isOpen, onClick } ) {\n\tconst {\n\t\tcommentStatus,\n\t\tpingStatus,\n\t\tcommentsSupported,\n\t\ttrackbacksSupported,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tcommentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',\n\t\t\tpingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',\n\t\t\tcommentsSupported: !! postType.supports.comments,\n\t\t\ttrackbacksSupported: !! postType.supports.trackbacks,\n\t\t};\n\t}, [] );\n\tlet label;\n\tif ( commentStatus === 'open' ) {\n\t\tif ( pingStatus === 'open' ) {\n\t\t\tlabel = _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t} else {\n\t\t\tlabel = trackbacksSupported\n\t\t\t\t? __( 'Comments only' )\n\t\t\t\t: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t}\n\t} else if ( pingStatus === 'open' ) {\n\t\tlabel = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );\n\t} else {\n\t\tlabel = __( 'Closed' );\n\t}\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-discussion__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ __( 'Change discussion options' ) }\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\n/**\n * This component allows to update comment and pingback\n * settings for the current post. Internally there are\n * checks whether the current post has support for the\n * above and if the `discussion-panel` panel is enabled.\n *\n * @return {JSX.Element|null} The rendered PostDiscussionPanel component.\n */\nexport default function PostDiscussionPanel() {\n\tconst { isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled } = select( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-discussion__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-discussion__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostDiscussionToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\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EAAGN,gBAAkB;MAAA3B,QAAA,eAClEP,IAAA,CAACjB,QAAQ;QACRoD,YAAY,EAAGA,YAAc;QAC7B7B,SAAS,EAAC,wCAAwC;QAClDmC,gBAAgB,EAAC,sCAAsC;QACvDC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAE/B,MAAM;UAAEgC;QAAS,CAAC,kBACpC5C,IAAA,CAACW,oBAAoB;UACpBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAG+B;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAExC;QAAQ,CAAC,kBAC5BL,IAAA,CAACI,aAAa;UAACC,OAAO,EAAGA;QAAS,CAAE;MAClC,CACH;IAAC,CACW;EAAC,CACM,CAAC;AAEzB","ignoreList":[]}
@@ -21,9 +21,7 @@ import { store as editorStore } from '../../store';
21
21
  /**
22
22
  * Module Constants
23
23
  */
24
- import { jsx as _jsx } from "react/jsx-runtime";
25
- import { Fragment as _Fragment } from "react/jsx-runtime";
26
- import { jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
27
25
  const PANEL_NAME = 'post-excerpt';
28
26
  function ExcerptPanel() {
29
27
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["__","PanelBody","__experimentalText","Text","Dropdown","Button","__experimentalVStack","VStack","useDispatch","useSelect","useMemo","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","decodeEntities","PostExcerptForm","PostExcerptCheck","PluginPostExcerpt","TEMPLATE_ORIGINS","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","toggleEditorPanelOpened","toggleExcerptPanel","shouldUseDescriptionLabel","includes","title","opened","onToggle","children","Slot","fills","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","getEntityRecord","_shouldRender","source","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","label","popoverProps","anchor","headerTitle","placement","offset","shift","excerptText","align","numberOfLines","truncate","excerptPlaceholder","triggerEditLabel","className","contentClassName","focusOnMount","ref","renderToggle","__next40pxDefaultSize","onClick","variant","renderContent","onClose","spacing","hideLabelFromVision","updateOnBlur"],"sources":["@wordpress/editor/src/components/post-excerpt/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\t__experimentalText as Text,\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostExcerptForm from './index';\nimport PostExcerptCheck from './check';\nimport PluginPostExcerpt from './plugin';\nimport { TEMPLATE_ORIGINS } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nfunction ExcerptPanel() {\n\tconst { isOpened, isEnabled, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelOpened,\n\t\t\tisEditorPanelEnabled,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\t// There are special cases where we want to label the excerpt as a description.\n\tconst shouldUseDescriptionLabel = [\n\t\t'wp_template',\n\t\t'wp_template_part',\n\t\t'wp_block',\n\t].includes( postType );\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\tshouldUseDescriptionLabel\n\t\t\t\t\t? __( 'Description' )\n\t\t\t\t\t: __( 'Excerpt' )\n\t\t\t}\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ toggleExcerptPanel }\n\t\t>\n\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostExcerpt.Slot>\n\t\t</PanelBody>\n\t);\n}\n\n/**\n * Is rendered if the post type supports excerpts and allows editing the excerpt.\n *\n * @return {JSX.Element} The rendered PostExcerptPanel component.\n */\nexport default function PostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<ExcerptPanel />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nexport function PrivatePostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PrivateExcerpt />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nfunction PrivateExcerpt() {\n\tconst { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tisEditorPanelEnabled,\n\t\t\t} = select( editorStore );\n\t\t\tconst postType = getCurrentPostType();\n\t\t\tconst isTemplateOrTemplatePart = [\n\t\t\t\t'wp_template',\n\t\t\t\t'wp_template_part',\n\t\t\t].includes( postType );\n\t\t\tconst isPattern = postType === 'wp_block';\n\t\t\t// These post types use the `excerpt` field as a description semantically, so we need to\n\t\t\t// handle proper labeling and some flows where we should always render them as text.\n\t\t\tconst _shouldBeUsedAsDescription =\n\t\t\t\tisTemplateOrTemplatePart || isPattern;\n\t\t\tconst _usedAttribute = isTemplateOrTemplatePart\n\t\t\t\t? 'description'\n\t\t\t\t: 'excerpt';\n\t\t\t// We need to fetch the entity in this case to check if we'll allow editing.\n\t\t\tconst template =\n\t\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tgetCurrentPostId()\n\t\t\t\t);\n\t\t\t// For post types that use excerpt as description, we do not abide\n\t\t\t// by the `isEnabled` panel flag in order to render them as text.\n\t\t\tconst _shouldRender =\n\t\t\t\tisEditorPanelEnabled( PANEL_NAME ) ||\n\t\t\t\t_shouldBeUsedAsDescription;\n\t\t\treturn {\n\t\t\t\texcerpt: getEditedPostAttribute( _usedAttribute ),\n\t\t\t\tshouldRender: _shouldRender,\n\t\t\t\tshouldBeUsedAsDescription: _shouldBeUsedAsDescription,\n\t\t\t\t// If we should render, allow editing for all post types that are not used as description.\n\t\t\t\t// For the rest allow editing only for user generated entities.\n\t\t\t\tallowEditing:\n\t\t\t\t\t_shouldRender &&\n\t\t\t\t\t( ! _shouldBeUsedAsDescription ||\n\t\t\t\t\t\tisPattern ||\n\t\t\t\t\t\t( template &&\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom &&\n\t\t\t\t\t\t\t! template.has_theme_file &&\n\t\t\t\t\t\t\ttemplate.is_custom ) ),\n\t\t\t};\n\t\t}, [] );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst label = shouldBeUsedAsDescription\n\t\t? __( 'Description' )\n\t\t: __( 'Excerpt' );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': label,\n\t\t\theaderTitle: label,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor, label ]\n\t);\n\tif ( ! shouldRender ) {\n\t\treturn false;\n\t}\n\tconst excerptText = !! excerpt && (\n\t\t<Text align=\"left\" numberOfLines={ 4 } truncate={ allowEditing }>\n\t\t\t{ decodeEntities( excerpt ) }\n\t\t</Text>\n\t);\n\tif ( ! allowEditing ) {\n\t\treturn excerptText;\n\t}\n\tconst excerptPlaceholder = shouldBeUsedAsDescription\n\t\t? __( 'Add a description…' )\n\t\t: __( 'Add an excerpt…' );\n\tconst triggerEditLabel = shouldBeUsedAsDescription\n\t\t? __( 'Edit description' )\n\t\t: __( 'Edit excerpt' );\n\treturn (\n\t\t<VStack>\n\t\t\t{ excerptText }\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"editor-post-excerpt__dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-excerpt__dropdown__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ excerptText ? triggerEditLabel : excerptPlaceholder }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<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GA,YAAc;MAC7Bc,YAAY;MACZC,GAAG,EAAGjB,gBAAkB;MACxBkB,YAAY,EAAGA,CAAE;QAAE3C;MAAS,CAAC,kBAC5BpB,IAAA,CAAClB,MAAM;QACNkF,qBAAqB;QACrBC,OAAO,EAAG7C,QAAU;QACpB8C,OAAO,EAAC,MAAM;QAAA7C,QAAA,EAEZgC,WAAW,GAAGK,gBAAgB,GAAGD;MAAkB,CAC9C,CACN;MACHU,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BhE,KAAA,CAAAF,SAAA;QAAAmB,QAAA,gBACCrB,IAAA,CAACV,sBAAsB;UACtB4B,KAAK,EAAG4B,KAAO;UACfsB,OAAO,EAAGA;QAAS,CACnB,CAAC,eAEFpE,IAAA,CAAChB,MAAM;UAACqF,OAAO,EAAG,CAAG;UAAAhD,QAAA,eACpBrB,IAAA,CAACJ,iBAAiB,CAAC0B,IAAI;YAAAD,QAAA,EAClBE,KAAK,iBACRnB,KAAA,CAAAF,SAAA;cAAAmB,QAAA,gBACCrB,IAAA,CAACN,eAAe;gBACf4E,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACAhD,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["__","PanelBody","__experimentalText","Text","Dropdown","Button","__experimentalVStack","VStack","useDispatch","useSelect","useMemo","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","decodeEntities","PostExcerptForm","PostExcerptCheck","PluginPostExcerpt","TEMPLATE_ORIGINS","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","toggleEditorPanelOpened","toggleExcerptPanel","shouldUseDescriptionLabel","includes","title","opened","onToggle","children","Slot","fills","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","getEntityRecord","_shouldRender","source","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","label","popoverProps","anchor","headerTitle","placement","offset","shift","excerptText","align","numberOfLines","truncate","excerptPlaceholder","triggerEditLabel","className","contentClassName","focusOnMount","ref","renderToggle","__next40pxDefaultSize","onClick","variant","renderContent","onClose","spacing","hideLabelFromVision","updateOnBlur"],"sources":["@wordpress/editor/src/components/post-excerpt/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\t__experimentalText as Text,\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostExcerptForm from './index';\nimport PostExcerptCheck from './check';\nimport PluginPostExcerpt from './plugin';\nimport { TEMPLATE_ORIGINS } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nfunction ExcerptPanel() {\n\tconst { isOpened, isEnabled, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelOpened,\n\t\t\tisEditorPanelEnabled,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\t// There are special cases where we want to label the excerpt as a description.\n\tconst shouldUseDescriptionLabel = [\n\t\t'wp_template',\n\t\t'wp_template_part',\n\t\t'wp_block',\n\t].includes( postType );\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\tshouldUseDescriptionLabel\n\t\t\t\t\t? __( 'Description' )\n\t\t\t\t\t: __( 'Excerpt' )\n\t\t\t}\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ toggleExcerptPanel }\n\t\t>\n\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostExcerpt.Slot>\n\t\t</PanelBody>\n\t);\n}\n\n/**\n * Is rendered if the post type supports excerpts and allows editing the excerpt.\n *\n * @return {JSX.Element} The rendered PostExcerptPanel component.\n */\nexport default function PostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<ExcerptPanel />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nexport function PrivatePostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PrivateExcerpt />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nfunction PrivateExcerpt() {\n\tconst { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tisEditorPanelEnabled,\n\t\t\t} = select( editorStore );\n\t\t\tconst postType = getCurrentPostType();\n\t\t\tconst isTemplateOrTemplatePart = [\n\t\t\t\t'wp_template',\n\t\t\t\t'wp_template_part',\n\t\t\t].includes( postType );\n\t\t\tconst isPattern = postType === 'wp_block';\n\t\t\t// These post types use the `excerpt` field as a description semantically, so we need to\n\t\t\t// handle proper labeling and some flows where we should always render them as text.\n\t\t\tconst _shouldBeUsedAsDescription =\n\t\t\t\tisTemplateOrTemplatePart || isPattern;\n\t\t\tconst _usedAttribute = isTemplateOrTemplatePart\n\t\t\t\t? 'description'\n\t\t\t\t: 'excerpt';\n\t\t\t// We need to fetch the entity in this case to check if we'll allow editing.\n\t\t\tconst template =\n\t\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tgetCurrentPostId()\n\t\t\t\t);\n\t\t\t// For post types that use excerpt as description, we do not abide\n\t\t\t// by the `isEnabled` panel flag in order to render them as text.\n\t\t\tconst _shouldRender =\n\t\t\t\tisEditorPanelEnabled( PANEL_NAME ) ||\n\t\t\t\t_shouldBeUsedAsDescription;\n\t\t\treturn {\n\t\t\t\texcerpt: getEditedPostAttribute( _usedAttribute ),\n\t\t\t\tshouldRender: _shouldRender,\n\t\t\t\tshouldBeUsedAsDescription: _shouldBeUsedAsDescription,\n\t\t\t\t// If we should render, allow editing for all post types that are not used as description.\n\t\t\t\t// For the rest allow editing only for user generated entities.\n\t\t\t\tallowEditing:\n\t\t\t\t\t_shouldRender &&\n\t\t\t\t\t( ! _shouldBeUsedAsDescription ||\n\t\t\t\t\t\tisPattern ||\n\t\t\t\t\t\t( template &&\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom &&\n\t\t\t\t\t\t\t! template.has_theme_file &&\n\t\t\t\t\t\t\ttemplate.is_custom ) ),\n\t\t\t};\n\t\t}, [] );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst label = shouldBeUsedAsDescription\n\t\t? __( 'Description' )\n\t\t: __( 'Excerpt' );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': label,\n\t\t\theaderTitle: label,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor, label ]\n\t);\n\tif ( ! shouldRender ) {\n\t\treturn false;\n\t}\n\tconst excerptText = !! excerpt && (\n\t\t<Text align=\"left\" numberOfLines={ 4 } truncate={ allowEditing }>\n\t\t\t{ decodeEntities( excerpt ) }\n\t\t</Text>\n\t);\n\tif ( ! allowEditing ) {\n\t\treturn excerptText;\n\t}\n\tconst excerptPlaceholder = shouldBeUsedAsDescription\n\t\t? __( 'Add a description…' )\n\t\t: __( 'Add an excerpt…' );\n\tconst triggerEditLabel = shouldBeUsedAsDescription\n\t\t? __( 'Edit description' )\n\t\t: __( 'Edit excerpt' );\n\treturn (\n\t\t<VStack>\n\t\t\t{ excerptText }\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"editor-post-excerpt__dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-excerpt__dropdown__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ excerptText ? triggerEditLabel : excerptPlaceholder }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\n\t\t\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B,EAAC,wCAAwC;MACzDb,YAAY,EAAGA,YAAc;MAC7Bc,YAAY;MACZC,GAAG,EAAGjB,gBAAkB;MACxBkB,YAAY,EAAGA,CAAE;QAAE3C;MAAS,CAAC,kBAC5BpB,IAAA,CAAClB,MAAM;QACNkF,qBAAqB;QACrBC,OAAO,EAAG7C,QAAU;QACpB8C,OAAO,EAAC,MAAM;QAAA7C,QAAA,EAEZgC,WAAW,GAAGK,gBAAgB,GAAGD;MAAkB,CAC9C,CACN;MACHU,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BhE,KAAA,CAAAF,SAAA;QAAAmB,QAAA,gBACCrB,IAAA,CAACV,sBAAsB;UACtB4B,KAAK,EAAG4B,KAAO;UACfsB,OAAO,EAAGA;QAAS,CACnB,CAAC,eAEFpE,IAAA,CAAChB,MAAM;UAACqF,OAAO,EAAG,CAAG;UAAAhD,QAAA,eACpBrB,IAAA,CAACJ,iBAAiB,CAAC0B,IAAI;YAAAD,QAAA,EAClBE,KAAK,iBACRnB,KAAA,CAAAF,SAAA;cAAAmB,QAAA,gBACCrB,IAAA,CAACN,eAAe;gBACf4E,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACAhD,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
@@ -16,8 +16,7 @@ import { store as coreStore } from '@wordpress/core-data';
16
16
  */
17
17
  import PostFeaturedImageCheck from './check';
18
18
  import { store as editorStore } from '../../store';
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
20
  const ALLOWED_MEDIA_TYPES = ['image'];
22
21
 
23
22
  // Used when labels from post type were not yet loaded or when they are not present.
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","jsx","_jsx","jsxs","_jsxs","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","getSettings","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","select","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACrE,SACCC,WAAW,EACXC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,SAAS;AAC5C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA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nCd,gBAAgB,CAACe,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDhB,aAAaA,CAAA,EAAG;MACfsD,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe/F,OAAO,CACrBP,WAAW,EACX4F,eAAe,EACfO,iBAAiB,EACjBlG,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAE0C,iBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","jsx","_jsx","jsxs","_jsxs","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","getSettings","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","select","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,oBAAo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ByC,QAAQ,CAAE;QAAEC,cAAc,EAAE1C,KAAK,CAAC3B;MAAG,CAAE,CAAC;IACzC,CAAC;IACDsE,WAAWA,CAAE/C,SAAS,EAAG;MACxBqC,MAAM,CAAE/E,gBAAiB,CAAC,CACxBwC,WAAW,CAAC,CAAC,CACbG,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzByC,QAAQ,CAAE;YAAEC,cAAc,EAAE1C,KAAK,CAAC3B;UAAG,CAAE,CAAC;QACzC,CAAC;QACD6B,OAAOA,CAAEC,OAAO,EAAG;UAClBb,gBAAgB,CAACc,gBAAgB,CAAC,CAAC;UACnCd,gBAAgB,CAACe,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDhB,aAAaA,CAAA,EAAG;MACfsD,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe/F,OAAO,CACrBP,WAAW,EACX4F,eAAe,EACfO,iBAAiB,EACjBlG,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAE0C,iBAAkB,CAAC","ignoreList":[]}
@@ -14,8 +14,7 @@ import PostFormatCheck from './check';
14
14
  import { store as editorStore } from '../../store';
15
15
 
16
16
  // All WP post formats, sorted alphabetically by translated name.
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
18
  export const POST_FORMATS = [{
20
19
  id: 'aside',
21
20
  caption: __('Aside')
@@ -120,7 +119,7 @@ export default function PostFormat() {
120
119
  __next40pxDefaultSize: true,
121
120
  variant: "link",
122
121
  onClick: () => onUpdatePostFormat(suggestion.id),
123
- children: sprintf( /* translators: %s: post format */
122
+ children: sprintf(/* translators: %s: post format */
124
123
  __('Apply suggested format: %s'), suggestion.caption)
125
124
  })
126
125
  })]
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Button","RadioControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","jsx","_jsx","jsxs","_jsxs","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","children","className","label","selected","onChange","options","map","value","hideLabelFromVision","__next40pxDefaultSize","variant","onClick"],"sources":["@wordpress/editor/src/components/post-format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, RadioControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n/**\n * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.\n *\n * @example\n * ```jsx\n * <PostFormat />\n * ```\n *\n * @return {JSX.Element} The rendered PostFormat component.\n */\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-post-format__options\"\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tselected={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,QAAQ,uBAAuB;AAC5D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;;AAElD;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AACA,OAAO,MAAMC,YAAY,GAAG,CAC3B;EAAEC,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAEjB,EAAE,CAAE,OAAQ;AAAE,CAAC,EACvC;EAAEgB,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAEjB,EAAE,CAAE,OAAQ;AAAE,CAAC,EACvC;EAAEgB,EAAE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AG;QACvDtB,EAAE,EAAGU,oBAAsB;QAC3BuB,OAAO,EAAGb,OAAO,CAACc,GAAG,CAAIZ,MAAM,KAAQ;UACtCQ,KAAK,EAAER,MAAM,CAACrB,OAAO;UACrBkC,KAAK,EAAEb,MAAM,CAACtB;QACf,CAAC,CAAG,CAAG;QACPoC,mBAAmB;MAAA,CACnB,CAAC,EACAZ,UAAU,IAAIA,UAAU,CAACxB,EAAE,KAAKW,UAAU,iBAC3Cf,IAAA;QAAGiC,SAAS,EAAC,gCAAgC;QAAAD,QAAA,eAC5ChC,IAAA,CAACV,MAAM;UACNmD,qBAAqB;UACrBC,OAAO,EAAC,MAAM;UACdC,OAAO,EAAGA,CAAA,KACTZ,kBAAkB,CAAEH,UAAU,CAACxB,EAAG,CAClC;UAAA4B,QAAA,EAEC3C,OAAO,EACR;UACAD,EAAE,CAAE,4BAA6B,CAAC,EAClCwC,UAAU,CAACvB,OACZ;QAAC,CACM;MAAC,CACP,CACH;IAAA,CACG;EAAC,CACU,CAAC;AAEpB","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","Button","RadioControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","jsx","_jsx","jsxs","_jsxs","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","children","className","label","selected","onChange","options","map","value","hideLabelFromVision","__next40pxDefaultSize","variant","onClick"],"sources":["@wordpress/editor/src/components/post-format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, RadioControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n/**\n * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.\n *\n * @example\n * ```jsx\n * <PostFormat />\n * ```\n *\n * @return {JSX.Element} The rendered PostFormat component.\n */\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-post-format__options\"\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tselected={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,QAAQ,uBAAuB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AI,CAC5BH,MAAM,IAAMA,MAAM,CAACtB,EAAE,KAAKY,eAC7B,CAAC;EAED,MAAM;IAAEc;EAAS,CAAC,GAAGtC,WAAW,CAAEM,WAAY,CAAC;EAE/C,MAAMiC,kBAAkB,GAAKL,MAAM,IAAMI,QAAQ,CAAE;IAAEJ;EAAO,CAAE,CAAC;EAE/D,oBACC1B,IAAA,CAACH,eAAe;IAAAmC,QAAA,eACf9B,KAAA;MAAK+B,SAAS,EAAC,oBAAoB;MAAAD,QAAA,gBAClChC,IAAA,CAACT,YAAY;QACZ0C,SAAS,EAAC,6BAA6B;QACvCC,KAAK,EAAG9C,EAAE,CAAE,aAAc,CAAG;QAC7B+C,QAAQ,EAAGpB,UAAY;QACvBqB,QAAQ,EAAKV,MAAM,IAAMK,kBAAkB,CAAEL,MAAO,CAAG;QACvDtB,EAAE,EAAGU,oBAAsB;QAC3BuB,OAAO,EAAGb,OAAO,CAACc,GAAG,CAAIZ,MAAM,KAAQ;UACtCQ,KAAK,EAAER,MAAM,CAACrB,OAAO;UACrBkC,KAAK,EAAEb,MAAM,CAACtB;QACf,CAAC,CAAG,CAAG;QACPoC,mBAAmB;MAAA,CACnB,CAAC,EACAZ,UAAU,IAAIA,UAAU,CAACxB,EAAE,KAAKW,UAAU,iBAC3Cf,IAAA;QAAGiC,SAAS,EAAC,gCAAgC;QAAAD,QAAA,eAC5ChC,IAAA,CAACV,MAAM;UACNmD,qBAAqB;UACrBC,OAAO,EAAC,MAAM;UACdC,OAAO,EAAGA,CAAA,KACTZ,kBAAkB,CAAEH,UAAU,CAACxB,EAAG,CAClC;UAAA4B,QAAA,EAEC3C,OAAO,CACR;UACAD,EAAE,CAAE,4BAA6B,CAAC,EAClCwC,UAAU,CAACvB,OACZ;QAAC,CACM;MAAC,CACP,CACH;IAAA,CACG;EAAC,CACU,CAAC;AAEpB","ignoreList":[]}
@@ -20,8 +20,7 @@ import { store as editorStore } from '../../store';
20
20
  *
21
21
  * @return {Component} The component to be rendered.
22
22
  */
23
- import { jsx as _jsx } from "react/jsx-runtime";
24
- import { jsxs as _jsxs } from "react/jsx-runtime";
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
24
  function PostFormat() {
26
25
  const {
27
26
  postFormat