@wordpress/editor 14.3.0 → 14.5.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 (537) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -1
  3. package/build/bindings/api.js +65 -0
  4. package/build/bindings/api.js.map +1 -0
  5. package/build/bindings/pattern-overrides.js +23 -13
  6. package/build/bindings/pattern-overrides.js.map +1 -1
  7. package/build/bindings/post-meta.js +35 -12
  8. package/build/bindings/post-meta.js.map +1 -1
  9. package/build/components/block-settings-menu/content-only-settings-menu.js +4 -1
  10. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  11. package/build/components/blog-title/index.js +7 -3
  12. package/build/components/blog-title/index.js.map +1 -1
  13. package/build/components/collapsible-block-toolbar/index.js +2 -3
  14. package/build/components/collapsible-block-toolbar/index.js.map +1 -1
  15. package/build/components/commands/index.js +8 -2
  16. package/build/components/commands/index.js.map +1 -1
  17. package/build/components/document-bar/index.js +1 -1
  18. package/build/components/document-bar/index.js.map +1 -1
  19. package/build/components/global-styles-provider/index.js +15 -3
  20. package/build/components/global-styles-provider/index.js.map +1 -1
  21. package/build/components/header/back-button.js +7 -8
  22. package/build/components/header/back-button.js.map +1 -1
  23. package/build/components/header/index.js +21 -20
  24. package/build/components/header/index.js.map +1 -1
  25. package/build/components/page-attributes/order.js +1 -67
  26. package/build/components/page-attributes/order.js.map +1 -1
  27. package/build/components/page-attributes/panel.js +1 -4
  28. package/build/components/page-attributes/panel.js.map +1 -1
  29. package/build/components/page-attributes/parent.js +6 -2
  30. package/build/components/page-attributes/parent.js.map +1 -1
  31. package/build/components/post-actions/actions.js +131 -344
  32. package/build/components/post-actions/actions.js.map +1 -1
  33. package/build/components/post-actions/index.js +16 -6
  34. package/build/components/post-actions/index.js.map +1 -1
  35. package/build/components/post-author/hook.js +10 -3
  36. package/build/components/post-author/hook.js.map +1 -1
  37. package/build/components/post-author/panel.js +2 -1
  38. package/build/components/post-author/panel.js.map +1 -1
  39. package/build/components/post-card-panel/index.js +9 -3
  40. package/build/components/post-card-panel/index.js.map +1 -1
  41. package/build/components/post-comments/index.js +6 -20
  42. package/build/components/post-comments/index.js.map +1 -1
  43. package/build/components/post-content-information/index.js +7 -1
  44. package/build/components/post-content-information/index.js.map +1 -1
  45. package/build/components/post-discussion/panel.js +2 -2
  46. package/build/components/post-discussion/panel.js.map +1 -1
  47. package/build/components/post-excerpt/panel.js +1 -1
  48. package/build/components/post-excerpt/panel.js.map +1 -1
  49. package/build/components/post-featured-image/index.js +3 -1
  50. package/build/components/post-featured-image/index.js.map +1 -1
  51. package/build/components/post-last-revision/index.js +2 -1
  52. package/build/components/post-last-revision/index.js.map +1 -1
  53. package/build/components/post-publish-button/index.js +4 -11
  54. package/build/components/post-publish-button/index.js.map +1 -1
  55. package/build/components/post-publish-panel/maybe-category-panel.js +4 -1
  56. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  57. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -1
  58. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  59. package/build/components/post-status/index.js +47 -51
  60. package/build/components/post-status/index.js.map +1 -1
  61. package/build/components/post-taxonomies/flat-term-selector.js +17 -6
  62. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  63. package/build/components/post-taxonomies/index.js +7 -1
  64. package/build/components/post-taxonomies/index.js.map +1 -1
  65. package/build/components/post-template/block-theme.js +4 -4
  66. package/build/components/post-template/block-theme.js.map +1 -1
  67. package/build/components/post-template/classic-theme.js +8 -2
  68. package/build/components/post-template/classic-theme.js.map +1 -1
  69. package/build/components/post-template/create-new-template-modal.js +3 -0
  70. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  71. package/build/components/post-template/create-new-template.js +4 -1
  72. package/build/components/post-template/create-new-template.js.map +1 -1
  73. package/build/components/post-template/hooks.js +5 -1
  74. package/build/components/post-template/hooks.js.map +1 -1
  75. package/build/components/post-template/panel.js +8 -2
  76. package/build/components/post-template/panel.js.map +1 -1
  77. package/build/components/post-trash/check.js +6 -4
  78. package/build/components/post-trash/check.js.map +1 -1
  79. package/build/components/post-url/panel.js +9 -4
  80. package/build/components/post-url/panel.js.map +1 -1
  81. package/build/components/posts-per-page/index.js +6 -2
  82. package/build/components/posts-per-page/index.js.map +1 -1
  83. package/build/components/preview-dropdown/index.js +82 -17
  84. package/build/components/preview-dropdown/index.js.map +1 -1
  85. package/build/components/provider/disable-non-page-content-blocks.js +14 -18
  86. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  87. package/build/components/provider/use-block-editor-settings.js +15 -6
  88. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  89. package/build/components/save-publish-panels/index.js +1 -2
  90. package/build/components/save-publish-panels/index.js.map +1 -1
  91. package/build/components/sidebar/index.js +3 -9
  92. package/build/components/sidebar/index.js.map +1 -1
  93. package/build/components/site-discussion/index.js +12 -22
  94. package/build/components/site-discussion/index.js.map +1 -1
  95. package/build/components/template-content-panel/index.js +17 -15
  96. package/build/components/template-content-panel/index.js.map +1 -1
  97. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -4
  98. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  99. package/build/components/visual-editor/index.js +7 -3
  100. package/build/components/visual-editor/index.js.map +1 -1
  101. package/build/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  102. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  103. package/build/dataviews/actions/delete-post.js +2 -0
  104. package/build/dataviews/actions/delete-post.js.map +1 -1
  105. package/build/dataviews/actions/export-pattern.native.js +9 -0
  106. package/build/dataviews/actions/export-pattern.native.js.map +1 -0
  107. package/build/dataviews/actions/permanently-delete-post.js +107 -0
  108. package/build/dataviews/actions/permanently-delete-post.js.map +1 -0
  109. package/build/dataviews/actions/restore-post.js +112 -0
  110. package/build/dataviews/actions/restore-post.js.map +1 -0
  111. package/build/dataviews/actions/trash-post.js +142 -0
  112. package/build/dataviews/actions/trash-post.js.map +1 -0
  113. package/build/dataviews/store/private-actions.js +45 -0
  114. package/build/dataviews/store/private-actions.js.map +1 -1
  115. package/build/dataviews/store/private-selectors.js +10 -10
  116. package/build/dataviews/store/private-selectors.js.map +1 -1
  117. package/build/dataviews/store/reducer.js +15 -1
  118. package/build/dataviews/store/reducer.js.map +1 -1
  119. package/build/dataviews/types.js.map +1 -1
  120. package/build/hooks/pattern-overrides.js +1 -1
  121. package/build/hooks/pattern-overrides.js.map +1 -1
  122. package/build/index.js +0 -1
  123. package/build/index.js.map +1 -1
  124. package/build/private-apis.js +3 -2
  125. package/build/private-apis.js.map +1 -1
  126. package/build/store/actions.js +16 -2
  127. package/build/store/actions.js.map +1 -1
  128. package/build/store/private-actions.js +8 -1
  129. package/build/store/private-actions.js.map +1 -1
  130. package/build/store/private-selectors.js +33 -2
  131. package/build/store/private-selectors.js.map +1 -1
  132. package/build/utils/media-upload/index.js +35 -2
  133. package/build/utils/media-upload/index.js.map +1 -1
  134. package/build-module/bindings/api.js +57 -0
  135. package/build-module/bindings/api.js.map +1 -0
  136. package/build-module/bindings/pattern-overrides.js +23 -13
  137. package/build-module/bindings/pattern-overrides.js.map +1 -1
  138. package/build-module/bindings/post-meta.js +35 -12
  139. package/build-module/bindings/post-meta.js.map +1 -1
  140. package/build-module/components/block-settings-menu/content-only-settings-menu.js +4 -1
  141. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  142. package/build-module/components/blog-title/index.js +7 -3
  143. package/build-module/components/blog-title/index.js.map +1 -1
  144. package/build-module/components/collapsible-block-toolbar/index.js +1 -2
  145. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  146. package/build-module/components/commands/index.js +8 -2
  147. package/build-module/components/commands/index.js.map +1 -1
  148. package/build-module/components/document-bar/index.js +1 -1
  149. package/build-module/components/document-bar/index.js.map +1 -1
  150. package/build-module/components/global-styles-provider/index.js +15 -3
  151. package/build-module/components/global-styles-provider/index.js.map +1 -1
  152. package/build-module/components/header/back-button.js +5 -7
  153. package/build-module/components/header/back-button.js.map +1 -1
  154. package/build-module/components/header/index.js +21 -22
  155. package/build-module/components/header/index.js.map +1 -1
  156. package/build-module/components/page-attributes/order.js +4 -70
  157. package/build-module/components/page-attributes/order.js.map +1 -1
  158. package/build-module/components/page-attributes/panel.js +1 -6
  159. package/build-module/components/page-attributes/panel.js.map +1 -1
  160. package/build-module/components/page-attributes/parent.js +7 -3
  161. package/build-module/components/page-attributes/parent.js.map +1 -1
  162. package/build-module/components/post-actions/actions.js +137 -350
  163. package/build-module/components/post-actions/actions.js.map +1 -1
  164. package/build-module/components/post-actions/index.js +16 -6
  165. package/build-module/components/post-actions/index.js.map +1 -1
  166. package/build-module/components/post-author/hook.js +10 -3
  167. package/build-module/components/post-author/hook.js.map +1 -1
  168. package/build-module/components/post-author/panel.js +2 -1
  169. package/build-module/components/post-author/panel.js.map +1 -1
  170. package/build-module/components/post-card-panel/index.js +9 -3
  171. package/build-module/components/post-card-panel/index.js.map +1 -1
  172. package/build-module/components/post-comments/index.js +8 -24
  173. package/build-module/components/post-comments/index.js.map +1 -1
  174. package/build-module/components/post-content-information/index.js +7 -1
  175. package/build-module/components/post-content-information/index.js.map +1 -1
  176. package/build-module/components/post-discussion/panel.js +3 -3
  177. package/build-module/components/post-discussion/panel.js.map +1 -1
  178. package/build-module/components/post-excerpt/panel.js +1 -1
  179. package/build-module/components/post-excerpt/panel.js.map +1 -1
  180. package/build-module/components/post-featured-image/index.js +3 -1
  181. package/build-module/components/post-featured-image/index.js.map +1 -1
  182. package/build-module/components/post-last-revision/index.js +2 -1
  183. package/build-module/components/post-last-revision/index.js.map +1 -1
  184. package/build-module/components/post-publish-button/index.js +4 -11
  185. package/build-module/components/post-publish-button/index.js.map +1 -1
  186. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -1
  187. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  188. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -1
  189. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  190. package/build-module/components/post-status/index.js +49 -53
  191. package/build-module/components/post-status/index.js.map +1 -1
  192. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -6
  193. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  194. package/build-module/components/post-taxonomies/index.js +7 -1
  195. package/build-module/components/post-taxonomies/index.js.map +1 -1
  196. package/build-module/components/post-template/block-theme.js +4 -4
  197. package/build-module/components/post-template/block-theme.js.map +1 -1
  198. package/build-module/components/post-template/classic-theme.js +8 -2
  199. package/build-module/components/post-template/classic-theme.js.map +1 -1
  200. package/build-module/components/post-template/create-new-template-modal.js +3 -0
  201. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  202. package/build-module/components/post-template/create-new-template.js +4 -1
  203. package/build-module/components/post-template/create-new-template.js.map +1 -1
  204. package/build-module/components/post-template/hooks.js +5 -1
  205. package/build-module/components/post-template/hooks.js.map +1 -1
  206. package/build-module/components/post-template/panel.js +8 -2
  207. package/build-module/components/post-template/panel.js.map +1 -1
  208. package/build-module/components/post-trash/check.js +6 -4
  209. package/build-module/components/post-trash/check.js.map +1 -1
  210. package/build-module/components/post-url/panel.js +10 -7
  211. package/build-module/components/post-url/panel.js.map +1 -1
  212. package/build-module/components/posts-per-page/index.js +6 -2
  213. package/build-module/components/posts-per-page/index.js.map +1 -1
  214. package/build-module/components/preview-dropdown/index.js +84 -19
  215. package/build-module/components/preview-dropdown/index.js.map +1 -1
  216. package/build-module/components/provider/disable-non-page-content-blocks.js +15 -19
  217. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  218. package/build-module/components/provider/use-block-editor-settings.js +15 -6
  219. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  220. package/build-module/components/save-publish-panels/index.js +1 -2
  221. package/build-module/components/save-publish-panels/index.js.map +1 -1
  222. package/build-module/components/sidebar/index.js +3 -9
  223. package/build-module/components/sidebar/index.js.map +1 -1
  224. package/build-module/components/site-discussion/index.js +14 -24
  225. package/build-module/components/site-discussion/index.js.map +1 -1
  226. package/build-module/components/template-content-panel/index.js +18 -16
  227. package/build-module/components/template-content-panel/index.js.map +1 -1
  228. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -4
  229. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  230. package/build-module/components/visual-editor/index.js +7 -3
  231. package/build-module/components/visual-editor/index.js.map +1 -1
  232. package/build-module/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  233. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  234. package/build-module/dataviews/actions/delete-post.js +2 -0
  235. package/build-module/dataviews/actions/delete-post.js.map +1 -1
  236. package/build-module/dataviews/actions/export-pattern.native.js +3 -0
  237. package/build-module/dataviews/actions/export-pattern.native.js.map +1 -0
  238. package/build-module/dataviews/actions/permanently-delete-post.js +99 -0
  239. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -0
  240. package/build-module/dataviews/actions/restore-post.js +104 -0
  241. package/build-module/dataviews/actions/restore-post.js.map +1 -0
  242. package/build-module/dataviews/actions/trash-post.js +135 -0
  243. package/build-module/dataviews/actions/trash-post.js.map +1 -0
  244. package/build-module/dataviews/store/private-actions.js +40 -0
  245. package/build-module/dataviews/store/private-actions.js.map +1 -1
  246. package/build-module/dataviews/store/private-selectors.js +8 -9
  247. package/build-module/dataviews/store/private-selectors.js.map +1 -1
  248. package/build-module/dataviews/store/reducer.js +15 -1
  249. package/build-module/dataviews/store/reducer.js.map +1 -1
  250. package/build-module/dataviews/types.js.map +1 -1
  251. package/build-module/hooks/pattern-overrides.js +1 -1
  252. package/build-module/hooks/pattern-overrides.js.map +1 -1
  253. package/build-module/index.js +0 -1
  254. package/build-module/index.js.map +1 -1
  255. package/build-module/private-apis.js +3 -2
  256. package/build-module/private-apis.js.map +1 -1
  257. package/build-module/store/actions.js +16 -2
  258. package/build-module/store/actions.js.map +1 -1
  259. package/build-module/store/private-actions.js +8 -1
  260. package/build-module/store/private-actions.js.map +1 -1
  261. package/build-module/store/private-selectors.js +32 -2
  262. package/build-module/store/private-selectors.js.map +1 -1
  263. package/build-module/utils/media-upload/index.js +36 -3
  264. package/build-module/utils/media-upload/index.js.map +1 -1
  265. package/build-style/style-rtl.css +97 -45
  266. package/build-style/style.css +97 -45
  267. package/build-types/bindings/api.d.ts +25 -0
  268. package/build-types/bindings/api.d.ts.map +1 -0
  269. package/build-types/bindings/pattern-overrides.d.ts +5 -6
  270. package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
  271. package/build-types/bindings/post-meta.d.ts +11 -7
  272. package/build-types/bindings/post-meta.d.ts.map +1 -1
  273. package/build-types/components/autocompleters/user.d.ts +2 -2
  274. package/build-types/components/autocompleters/user.d.ts.map +1 -1
  275. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
  276. package/build-types/components/blog-title/index.d.ts.map +1 -1
  277. package/build-types/components/collapsible-block-toolbar/index.d.ts +1 -2
  278. package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -1
  279. package/build-types/components/commands/index.d.ts.map +1 -1
  280. package/build-types/components/document-bar/index.d.ts.map +1 -1
  281. package/build-types/components/document-outline/check.d.ts.map +1 -1
  282. package/build-types/components/document-outline/index.d.ts.map +1 -1
  283. package/build-types/components/editor-history/redo.d.ts +1 -1
  284. package/build-types/components/editor-history/undo.d.ts +1 -1
  285. package/build-types/components/editor-notices/index.d.ts.map +1 -1
  286. package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
  287. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  288. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  289. package/build-types/components/header/back-button.d.ts +1 -0
  290. package/build-types/components/header/back-button.d.ts.map +1 -1
  291. package/build-types/components/header/index.d.ts.map +1 -1
  292. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  293. package/build-types/components/media-categories/index.d.ts.map +1 -1
  294. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  295. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  296. package/build-types/components/page-attributes/check.d.ts.map +1 -1
  297. package/build-types/components/page-attributes/order.d.ts +1 -1
  298. package/build-types/components/page-attributes/order.d.ts.map +1 -1
  299. package/build-types/components/page-attributes/panel.d.ts.map +1 -1
  300. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  301. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  302. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  303. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  304. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  305. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  306. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
  307. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  308. package/build-types/components/post-actions/index.d.ts.map +1 -1
  309. package/build-types/components/post-author/check.d.ts.map +1 -1
  310. package/build-types/components/post-author/hook.d.ts +1 -1
  311. package/build-types/components/post-author/hook.d.ts.map +1 -1
  312. package/build-types/components/post-author/index.d.ts.map +1 -1
  313. package/build-types/components/post-author/panel.d.ts.map +1 -1
  314. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  315. package/build-types/components/post-comments/index.d.ts.map +1 -1
  316. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  317. package/build-types/components/post-discussion/panel.d.ts.map +1 -1
  318. package/build-types/components/post-excerpt/check.d.ts.map +1 -1
  319. package/build-types/components/post-excerpt/index.d.ts.map +1 -1
  320. package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
  321. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  322. package/build-types/components/post-featured-image/check.d.ts.map +1 -1
  323. package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
  324. package/build-types/components/post-format/index.d.ts.map +1 -1
  325. package/build-types/components/post-format/panel.d.ts.map +1 -1
  326. package/build-types/components/post-last-revision/check.d.ts.map +1 -1
  327. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  328. package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
  329. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  330. package/build-types/components/post-pending-status/check.d.ts.map +1 -1
  331. package/build-types/components/post-pending-status/index.d.ts.map +1 -1
  332. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  333. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  334. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  335. package/build-types/components/post-saved-state/index.d.ts +1 -1
  336. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  337. package/build-types/components/post-schedule/check.d.ts.map +1 -1
  338. package/build-types/components/post-schedule/index.d.ts.map +1 -1
  339. package/build-types/components/post-schedule/label.d.ts.map +1 -1
  340. package/build-types/components/post-schedule/panel.d.ts.map +1 -1
  341. package/build-types/components/post-slug/check.d.ts.map +1 -1
  342. package/build-types/components/post-slug/index.d.ts.map +1 -1
  343. package/build-types/components/post-status/index.d.ts +2 -1
  344. package/build-types/components/post-status/index.d.ts.map +1 -1
  345. package/build-types/components/post-sticky/check.d.ts.map +1 -1
  346. package/build-types/components/post-sticky/index.d.ts.map +1 -1
  347. package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
  348. package/build-types/components/post-sync-status/index.d.ts.map +1 -1
  349. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  350. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +9 -7
  351. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  352. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +13 -11
  353. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  354. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  355. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  356. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  357. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  358. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  359. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  360. package/build-types/components/post-template/panel.d.ts.map +1 -1
  361. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  362. package/build-types/components/post-trash/check.d.ts.map +1 -1
  363. package/build-types/components/post-trash/index.d.ts.map +1 -1
  364. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  365. package/build-types/components/post-url/check.d.ts.map +1 -1
  366. package/build-types/components/post-url/index.d.ts.map +1 -1
  367. package/build-types/components/post-url/label.d.ts.map +1 -1
  368. package/build-types/components/post-url/panel.d.ts.map +1 -1
  369. package/build-types/components/post-visibility/check.d.ts.map +1 -1
  370. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  371. package/build-types/components/posts-per-page/index.d.ts.map +1 -1
  372. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  373. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  374. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  375. package/build-types/components/provider/index.d.ts.map +1 -1
  376. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  377. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  378. package/build-types/components/sidebar/index.d.ts.map +1 -1
  379. package/build-types/components/site-discussion/index.d.ts.map +1 -1
  380. package/build-types/components/template-content-panel/index.d.ts +1 -3
  381. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  382. package/build-types/components/theme-support-check/index.d.ts.map +1 -1
  383. package/build-types/components/time-to-read/index.d.ts.map +1 -1
  384. package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
  385. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
  386. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  387. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  388. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -0
  389. package/build-types/components/word-count/index.d.ts.map +1 -1
  390. package/build-types/dataviews/actions/delete-post.d.ts.map +1 -1
  391. package/build-types/dataviews/actions/export-pattern.native.d.ts +3 -0
  392. package/build-types/dataviews/actions/export-pattern.native.d.ts.map +1 -0
  393. package/build-types/dataviews/actions/permanently-delete-post.d.ts +5 -0
  394. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -0
  395. package/build-types/dataviews/actions/restore-post.d.ts +5 -0
  396. package/build-types/dataviews/actions/restore-post.d.ts.map +1 -0
  397. package/build-types/dataviews/actions/trash-post.d.ts +5 -0
  398. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -0
  399. package/build-types/dataviews/api.d.ts +1 -1
  400. package/build-types/dataviews/api.d.ts.map +1 -1
  401. package/build-types/dataviews/store/private-actions.d.ts +8 -3
  402. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  403. package/build-types/dataviews/store/private-selectors.d.ts +2 -2
  404. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
  405. package/build-types/dataviews/store/reducer.d.ts +4 -1
  406. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  407. package/build-types/dataviews/types.d.ts +9 -0
  408. package/build-types/dataviews/types.d.ts.map +1 -1
  409. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +1 -1
  410. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
  411. package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
  412. package/build-types/private-apis.d.ts.map +1 -1
  413. package/build-types/store/actions.d.ts.map +1 -1
  414. package/build-types/store/private-actions.d.ts.map +1 -1
  415. package/build-types/store/private-selectors.d.ts +11 -0
  416. package/build-types/store/private-selectors.d.ts.map +1 -1
  417. package/build-types/store/reducer.d.ts +1 -0
  418. package/build-types/store/reducer.d.ts.map +1 -1
  419. package/build-types/store/selectors.d.ts +0 -1
  420. package/build-types/store/selectors.d.ts.map +1 -1
  421. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  422. package/package.json +38 -37
  423. package/src/bindings/api.js +57 -0
  424. package/src/bindings/pattern-overrides.js +28 -17
  425. package/src/bindings/post-meta.js +39 -14
  426. package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
  427. package/src/components/blog-title/index.js +8 -3
  428. package/src/components/collapsible-block-toolbar/index.js +1 -3
  429. package/src/components/collapsible-block-toolbar/style.scss +0 -3
  430. package/src/components/commands/index.js +4 -2
  431. package/src/components/document-bar/index.js +1 -1
  432. package/src/components/document-bar/style.scss +2 -6
  433. package/src/components/document-tools/style.scss +4 -4
  434. package/src/components/editor-interface/style.scss +9 -0
  435. package/src/components/global-styles-provider/index.js +22 -11
  436. package/src/components/header/back-button.js +6 -6
  437. package/src/components/header/index.js +27 -27
  438. package/src/components/header/style.scss +64 -21
  439. package/src/components/inserter-sidebar/style.scss +1 -6
  440. package/src/components/list-view-sidebar/style.scss +4 -0
  441. package/src/components/page-attributes/order.js +3 -77
  442. package/src/components/page-attributes/panel.js +1 -7
  443. package/src/components/page-attributes/parent.js +25 -7
  444. package/src/components/post-actions/actions.js +158 -463
  445. package/src/components/post-actions/index.js +19 -7
  446. package/src/components/post-author/hook.js +11 -3
  447. package/src/components/post-author/panel.js +3 -1
  448. package/src/components/post-card-panel/index.js +9 -3
  449. package/src/components/post-comments/index.js +8 -21
  450. package/src/components/post-content-information/index.js +7 -1
  451. package/src/components/post-discussion/panel.js +5 -3
  452. package/src/components/post-excerpt/panel.js +2 -1
  453. package/src/components/post-featured-image/index.js +5 -1
  454. package/src/components/post-last-revision/index.js +1 -0
  455. package/src/components/post-panel-row/style.scss +0 -1
  456. package/src/components/post-publish-button/index.js +4 -17
  457. package/src/components/post-publish-panel/maybe-category-panel.js +4 -1
  458. package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
  459. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  460. package/src/components/post-status/index.js +29 -51
  461. package/src/components/post-taxonomies/flat-term-selector.js +19 -5
  462. package/src/components/post-taxonomies/index.js +8 -1
  463. package/src/components/post-template/block-theme.js +5 -1
  464. package/src/components/post-template/classic-theme.js +8 -3
  465. package/src/components/post-template/create-new-template-modal.js +7 -1
  466. package/src/components/post-template/create-new-template.js +4 -1
  467. package/src/components/post-template/hooks.js +8 -2
  468. package/src/components/post-template/panel.js +10 -2
  469. package/src/components/post-trash/check.js +9 -5
  470. package/src/components/post-url/panel.js +15 -4
  471. package/src/components/posts-per-page/index.js +7 -2
  472. package/src/components/preview-dropdown/index.js +113 -35
  473. package/src/components/preview-dropdown/style.scss +5 -0
  474. package/src/components/provider/disable-non-page-content-blocks.js +27 -24
  475. package/src/components/provider/use-block-editor-settings.js +15 -6
  476. package/src/components/save-publish-panels/index.js +1 -4
  477. package/src/components/sidebar/index.js +2 -5
  478. package/src/components/site-discussion/index.js +15 -22
  479. package/src/components/template-content-panel/index.js +37 -21
  480. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  481. package/src/components/visual-editor/index.js +13 -8
  482. package/src/components/visual-editor/style.scss +1 -4
  483. package/src/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  484. package/src/dataviews/actions/delete-post.tsx +2 -0
  485. package/src/dataviews/actions/export-pattern.native.tsx +3 -0
  486. package/src/dataviews/actions/permanently-delete-post.tsx +116 -0
  487. package/src/dataviews/actions/restore-post.tsx +134 -0
  488. package/src/dataviews/actions/trash-post.tsx +196 -0
  489. package/src/dataviews/store/private-actions.ts +68 -0
  490. package/src/dataviews/store/private-selectors.ts +9 -17
  491. package/src/dataviews/store/reducer.ts +20 -1
  492. package/src/dataviews/types.ts +11 -0
  493. package/src/hooks/pattern-overrides.js +1 -1
  494. package/src/index.js +0 -1
  495. package/src/private-apis.js +6 -2
  496. package/src/store/actions.js +36 -13
  497. package/src/store/private-actions.js +8 -4
  498. package/src/store/private-selectors.js +45 -2
  499. package/src/store/test/actions.js +9 -3
  500. package/src/store/test/private-selectors.js +78 -0
  501. package/src/utils/media-upload/index.js +38 -3
  502. package/tsconfig.tsbuildinfo +1 -1
  503. package/build/bindings/index.js +0 -22
  504. package/build/bindings/index.js.map +0 -1
  505. package/build/dataviews/actions/index.js +0 -32
  506. package/build/dataviews/actions/index.js.map +0 -1
  507. package/build/hooks/use-select-nearest-editable-block.js.map +0 -1
  508. package/build/store/utils/get-filtered-template-parts.js +0 -71
  509. package/build/store/utils/get-filtered-template-parts.js.map +0 -1
  510. package/build/utils/set-nested-value.js +0 -44
  511. package/build/utils/set-nested-value.js.map +0 -1
  512. package/build-module/bindings/index.js +0 -17
  513. package/build-module/bindings/index.js.map +0 -1
  514. package/build-module/dataviews/actions/index.js +0 -24
  515. package/build-module/dataviews/actions/index.js.map +0 -1
  516. package/build-module/hooks/use-select-nearest-editable-block.js.map +0 -1
  517. package/build-module/store/utils/get-filtered-template-parts.js +0 -64
  518. package/build-module/store/utils/get-filtered-template-parts.js.map +0 -1
  519. package/build-module/utils/set-nested-value.js +0 -38
  520. package/build-module/utils/set-nested-value.js.map +0 -1
  521. package/build-types/bindings/index.d.ts +0 -2
  522. package/build-types/bindings/index.d.ts.map +0 -1
  523. package/build-types/dataviews/actions/index.d.ts +0 -2
  524. package/build-types/dataviews/actions/index.d.ts.map +0 -1
  525. package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +0 -1
  526. package/build-types/store/utils/get-filtered-template-parts.d.ts +0 -3
  527. package/build-types/store/utils/get-filtered-template-parts.d.ts.map +0 -1
  528. package/build-types/utils/set-nested-value.d.ts +0 -20
  529. package/build-types/utils/set-nested-value.d.ts.map +0 -1
  530. package/src/bindings/index.js +0 -15
  531. package/src/components/document-outline/test/__snapshots__/index.js.snap +0 -111
  532. package/src/components/document-outline/test/index.js +0 -185
  533. package/src/dataviews/actions/index.ts +0 -25
  534. package/src/store/utils/get-filtered-template-parts.js +0 -69
  535. package/src/store/utils/test/get-filtered-template-parts.js +0 -189
  536. package/src/utils/set-nested-value.js +0 -39
  537. /package/build-types/{hooks → components/visual-editor}/use-select-nearest-editable-block.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_flatTermSelector","_interopRequireDefault","_store","_jsxRuntime","TagsPanel","panelBodyTitle","__","jsx","className","children","jsxs","PanelBody","initialOpen","title","default","slug","MaybeTagsPanel","hasTags","isPostTypeSupported","useSelect","select","postType","editorStore","getCurrentPostType","tagsTaxonomy","coreStore","getTaxonomy","_isPostTypeSupported","types","includes","areTagsFetched","undefined","tags","getEditedPostAttribute","rest_base","length","hadTagsWhenOpeningThePanel","useState","_default","exports"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug=\"post_tag\" />\n\t\t</PanelBody>\n\t);\n};\n\nconst MaybeTagsPanel = () => {\n\tconst { hasTags, isPostTypeSupported } = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst _isPostTypeSupported = tagsTaxonomy?.types?.includes( postType );\n\t\tconst areTagsFetched = tagsTaxonomy !== undefined;\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\thasTags: !! tags?.length,\n\t\t\tisPostTypeSupported: areTagsFetched && _isPostTypeSupported,\n\t\t};\n\t}, [] );\n\tconst [ hadTagsWhenOpeningThePanel ] = useState( hasTags );\n\n\tif ( ! isPostTypeSupported ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\tif ( ! hadTagsWhenOpeningThePanel ) {\n\t\treturn <TagsPanel />;\n\t}\n\n\treturn null;\n};\n\nexport default MaybeTagsPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,iBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAbnD;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAMS,SAAS,GAAGA,CAAA,KAAM;EACvB,MAAMC,cAAc,GAAG,CACtB,IAAAC,QAAE,EAAE,aAAc,CAAC,eACnB,IAAAH,WAAA,CAAAI,GAAA;IAAMC,SAAS,EAAC,iCAAiC;IAAAC,QAAA,EAC9C,IAAAH,QAAE,EAAE,UAAW;EAAC,GADmC,OAEhD,CAAC,CACP;EAED,oBACC,IAAAH,WAAA,CAAAO,I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GAAA,EAACH,SAAS,IAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAzB,OAAA,GAEaE,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_flatTermSelector","_interopRequireDefault","_store","_jsxRuntime","TagsPanel","panelBodyTitle","__","jsx","className","children","jsxs","PanelBody","initialOpen","title","default","slug","__nextHasNoMarginBottom","MaybeTagsPanel","hasTags","isPostTypeSupported","useSelect","select","postType","editorStore","getCurrentPostType","tagsTaxonomy","coreStore","getTaxonomy","_isPostTypeSupported","types","includes","areTagsFetched","undefined","tags","getEditedPostAttribute","rest_base","length","hadTagsWhenOpeningThePanel","useState","_default","exports"],"sources":["@wordpress/editor/src/components/post-publish-panel/maybe-tags-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport FlatTermSelector from '../post-taxonomies/flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst TagsPanel = () => {\n\tconst panelBodyTitle = [\n\t\t__( 'Suggestion:' ),\n\t\t<span className=\"editor-post-publish-panel__link\" key=\"label\">\n\t\t\t{ __( 'Add tags' ) }\n\t\t</span>,\n\t];\n\n\treturn (\n\t\t<PanelBody initialOpen={ false } title={ panelBodyTitle }>\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<FlatTermSelector slug=\"post_tag\" __nextHasNoMarginBottom />\n\t\t</PanelBody>\n\t);\n};\n\nconst MaybeTagsPanel = () => {\n\tconst { hasTags, isPostTypeSupported } = useSelect( ( select ) => {\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tconst tagsTaxonomy = select( coreStore ).getTaxonomy( 'post_tag' );\n\t\tconst _isPostTypeSupported = tagsTaxonomy?.types?.includes( postType );\n\t\tconst areTagsFetched = tagsTaxonomy !== undefined;\n\t\tconst tags =\n\t\t\ttagsTaxonomy &&\n\t\t\tselect( editorStore ).getEditedPostAttribute(\n\t\t\t\ttagsTaxonomy.rest_base\n\t\t\t);\n\t\treturn {\n\t\t\thasTags: !! tags?.length,\n\t\t\tisPostTypeSupported: areTagsFetched && _isPostTypeSupported,\n\t\t};\n\t}, [] );\n\tconst [ hadTagsWhenOpeningThePanel ] = useState( hasTags );\n\n\tif ( ! isPostTypeSupported ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * We only want to show the tag panel if the post didn't have\n\t * any tags when the user hit the Publish button.\n\t *\n\t * We can't use the prop.hasTags because it'll change to true\n\t * if the user adds a new tag within the pre-publish panel.\n\t * This would force a re-render and a new prop.hasTags check,\n\t * hiding this panel and keeping the user from adding\n\t * more than one tag.\n\t */\n\tif ( ! hadTagsWhenOpeningThePanel ) {\n\t\treturn <TagsPanel />;\n\t}\n\n\treturn null;\n};\n\nexport default MaybeTagsPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,iBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAbnD;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAMS,SAAS,GAAGA,CAAA,KAAM;EACvB,MAAMC,cAAc,GAAG,CACtB,IAAAC,QAAE,EAAE,aAAc,CAAC,eACnB,IAAAH,WAAA,CAAAI,GAAA;IAAMC,SAAS,EAAC,iCAAiC;IAAAC,Q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;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IAAK,CAAEkB,0BAA0B,EAAG;IACnC,oBAAO,IAAAlC,WAAA,CAAAI,GAAA,EAACH,SAAS,IAAE,CAAC;EACrB;EAEA,OAAO,IAAI;AACZ,CAAC;AAAC,IAAAmC,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAEaG,cAAc","ignoreList":[]}
@@ -13,6 +13,7 @@ var _element = require("@wordpress/element");
13
13
  var _coreData = require("@wordpress/core-data");
14
14
  var _blockEditor = require("@wordpress/block-editor");
15
15
  var _compose = require("@wordpress/compose");
16
+ var _icons = require("@wordpress/icons");
16
17
  var _constants = require("../../store/constants");
17
18
  var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
18
19
  var _postSticky = _interopRequireDefault(require("../post-sticky"));
@@ -27,59 +28,52 @@ var _jsxRuntime = require("react/jsx-runtime");
27
28
  * Internal dependencies
28
29
  */
29
30
 
30
- const labels = {
31
- 'auto-draft': (0, _i18n.__)('Draft'),
32
- draft: (0, _i18n.__)('Draft'),
33
- pending: (0, _i18n.__)('Pending'),
34
- private: (0, _i18n.__)('Private'),
35
- future: (0, _i18n.__)('Scheduled'),
36
- publish: (0, _i18n.__)('Published')
31
+ const postStatusesInfo = {
32
+ 'auto-draft': {
33
+ label: (0, _i18n.__)('Draft'),
34
+ icon: _icons.drafts
35
+ },
36
+ draft: {
37
+ label: (0, _i18n.__)('Draft'),
38
+ icon: _icons.drafts
39
+ },
40
+ pending: {
41
+ label: (0, _i18n.__)('Pending'),
42
+ icon: _icons.pending
43
+ },
44
+ private: {
45
+ label: (0, _i18n.__)('Private'),
46
+ icon: _icons.notAllowed
47
+ },
48
+ future: {
49
+ label: (0, _i18n.__)('Scheduled'),
50
+ icon: _icons.scheduled
51
+ },
52
+ publish: {
53
+ label: (0, _i18n.__)('Published'),
54
+ icon: _icons.published
55
+ }
37
56
  };
38
57
  const STATUS_OPTIONS = exports.STATUS_OPTIONS = [{
39
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
40
- children: [(0, _i18n.__)('Draft'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
41
- variant: "muted",
42
- size: 12,
43
- children: (0, _i18n.__)('Not ready to publish.')
44
- })]
45
- }),
46
- value: 'draft'
58
+ label: (0, _i18n.__)('Draft'),
59
+ value: 'draft',
60
+ description: (0, _i18n.__)('Not ready to publish.')
47
61
  }, {
48
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
49
- children: [(0, _i18n.__)('Pending'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
50
- variant: "muted",
51
- size: 12,
52
- children: (0, _i18n.__)('Waiting for review before publishing.')
53
- })]
54
- }),
55
- value: 'pending'
62
+ label: (0, _i18n.__)('Pending'),
63
+ value: 'pending',
64
+ description: (0, _i18n.__)('Waiting for review before publishing.')
56
65
  }, {
57
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
58
- children: [(0, _i18n.__)('Private'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
59
- variant: "muted",
60
- size: 12,
61
- children: (0, _i18n.__)('Only visible to site admins and editors.')
62
- })]
63
- }),
64
- value: 'private'
66
+ label: (0, _i18n.__)('Private'),
67
+ value: 'private',
68
+ description: (0, _i18n.__)('Only visible to site admins and editors.')
65
69
  }, {
66
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
67
- children: [(0, _i18n.__)('Scheduled'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
68
- variant: "muted",
69
- size: 12,
70
- children: (0, _i18n.__)('Publish automatically on a chosen date.')
71
- })]
72
- }),
73
- value: 'future'
70
+ label: (0, _i18n.__)('Scheduled'),
71
+ value: 'future',
72
+ description: (0, _i18n.__)('Publish automatically on a chosen date.')
74
73
  }, {
75
- label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
76
- children: [(0, _i18n.__)('Published'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
77
- variant: "muted",
78
- size: 12,
79
- children: (0, _i18n.__)('Visible to everyone.')
80
- })]
81
- }),
82
- value: 'publish'
74
+ label: (0, _i18n.__)('Published'),
75
+ value: 'publish',
76
+ description: (0, _i18n.__)('Visible to everyone.')
83
77
  }];
84
78
  const DESIGN_POST_TYPES = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.PATTERN_POST_TYPE, _constants.NAVIGATION_POST_TYPE];
85
79
  function PostStatus() {
@@ -175,10 +169,11 @@ function PostStatus() {
175
169
  variant: "tertiary",
176
170
  size: "compact",
177
171
  onClick: onToggle,
172
+ icon: postStatusesInfo[status]?.icon,
178
173
  "aria-label": (0, _i18n.sprintf)(
179
174
  // translators: %s: Current post status.
180
- (0, _i18n.__)('Change post status: %s'), labels[status]),
181
- children: labels[status]
175
+ (0, _i18n.__)('Change post status: %s'), postStatusesInfo[status]?.label),
176
+ children: postStatusesInfo[status]?.label
182
177
  }),
183
178
  renderContent: ({
184
179
  onClose
@@ -224,7 +219,8 @@ function PostStatus() {
224
219
  type: "text",
225
220
  id: passwordInputId,
226
221
  __next40pxDefaultSize: true,
227
- __nextHasNoMarginBottom: true
222
+ __nextHasNoMarginBottom: true,
223
+ maxLength: 255
228
224
  })
229
225
  })]
230
226
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postSticky.default, {})]
@@ -233,7 +229,7 @@ function PostStatus() {
233
229
  })
234
230
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
235
231
  className: "editor-post-status is-read-only",
236
- children: labels[status]
232
+ children: postStatusesInfo[status]?.label
237
233
  })
238
234
  });
239
235
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_constants","_postPanelRow","_interopRequireDefault","_postSticky","_postSchedule","_store","_jsxRuntime","labels","__","draft","pending","private","future","publish","STATUS_OPTIONS","exports","label","jsxs","Fragment","children","jsx","__experimentalText","variant","size","value","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","default","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","Button","onClick","sprintf","renderContent","onClose","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport PostSticky from '../post-sticky';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst labels = {\n\t'auto-draft': __( 'Draft' ),\n\tdraft: __( 'Draft' ),\n\tpending: __( 'Pending' ),\n\tprivate: __( 'Private' ),\n\tfuture: __( 'Scheduled' ),\n\tpublish: __( 'Published' ),\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Not ready to publish.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visible to everyone.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\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\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\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 ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tlabels[ status ]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\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<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\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\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\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\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\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\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<PostSticky />\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAMA,IAAAQ,aAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAmD,IAAAa,WAAA,GAAAb,OAAA;AA/BnD;AACA;AACA;;AAiBA;AACA;AACA;;AAYA,MAAMc,MAAM,GAAG;EACd,YAAY,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EAC3BC,KAAK,EAAE,IAAAD,QAAE,EAAE,OAAQ,CAAC;EACpBE,OAAO,EAAE,IAAAF,QAAE,EAAE,SAAU,CAAC;EACxBG,OAAO,EAAE,IAAAH,QAA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A,EAACzB,WAAA,CAAA8F,oBAAM;cACNU,EAAE,EAAC,UAAU;cACbT,OAAO,EAAG,CAAG;cACbb,SAAS,EAAC,yCAAyC;cAAAvD,QAAA,gBAEnD,IAAAb,WAAA,CAAAc,GAAA,EAAC5B,WAAA,CAAAyG,eAAe;gBACfC,uBAAuB;gBACvBlF,KAAK,EAAG,IAAAR,QAAE,EACT,oBACD,CAAG;gBACH2F,IAAI,EAAG,IAAA3F,QAAE,EACR,6CACD,CAAG;gBACH4F,OAAO,EAAGtD,YAAc;gBACxB6C,QAAQ,EACPvB;cACA,CACD,CAAC,EACAtB,YAAY,iBACb,IAAAxC,WAAA,CAAAc,GAAA;gBAAKsD,SAAS,EAAC,sCAAsC;gBAAAvD,QAAA,eACpD,IAAAb,WAAA,CAAAc,GAAA,EAAC5B,WAAA,CAAA6G,WAAW;kBACXrF,KAAK,EAAG,IAAAR,QAAE,EACT,UACD,CAAG;kBACHmF,QAAQ,EAAKnE,KAAK,IACjBwC,UAAU,CAAE;oBACX/B,QAAQ,EAAET;kBACX,CAAE,CACF;kBACDA,KAAK,EAAGS,QAAU;kBAClBqE,WAAW,EAAG,IAAA9F,QAAE,EACf,uBACD,CAAG;kBACH+F,IAAI,EAAC,MAAM;kBACXC,EAAE,EAAGvD,eAAiB;kBACtBwD,qBAAqB;kBACrBP,uBAAuB;gBAAA,CACvB;cAAC,CACE,CACL;YAAA,CACM,CACR,eACD,IAAA5F,WAAA,CAAAc,GAAA,EAACjB,WAAA,CAAAoE,OAAU,IAAE,CAAC;UAAA,CACP;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEF,IAAAjE,WAAA,CAAAc,GAAA;MAAKsD,SAAS,EAAC,iCAAiC;MAAAvD,QAAA,EAC7CZ,MAAM,CAAEwB,MAAM;IAAE,CACd;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_icons","_constants","_postPanelRow","_interopRequireDefault","_postSticky","_postSchedule","_store","_jsxRuntime","postStatusesInfo","label","__","icon","drafts","draft","pending","private","notAllowed","future","scheduled","publish","published","STATUS_OPTIONS","exports","value","description","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","jsx","default","ref","children","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","Button","variant","size","onClick","sprintf","renderContent","onClose","jsxs","Fragment","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize","maxLength"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport PostSticky from '../post-sticky';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst postStatusesInfo = {\n\t'auto-draft': { label: __( 'Draft' ), icon: drafts },\n\tdraft: { label: __( 'Draft' ), icon: drafts },\n\tpending: { label: __( 'Pending' ), icon: pending },\n\tprivate: { label: __( 'Private' ), icon: notAllowed },\n\tfuture: { label: __( 'Scheduled' ), icon: scheduled },\n\tpublish: { label: __( 'Published' ), icon: published },\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: __( 'Draft' ),\n\t\tvalue: 'draft',\n\t\tdescription: __( 'Not ready to publish.' ),\n\t},\n\t{\n\t\tlabel: __( 'Pending' ),\n\t\tvalue: 'pending',\n\t\tdescription: __( 'Waiting for review before publishing.' ),\n\t},\n\t{\n\t\tlabel: __( 'Private' ),\n\t\tvalue: 'private',\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tlabel: __( 'Scheduled' ),\n\t\tvalue: 'future',\n\t\tdescription: __( 'Publish automatically on a chosen date.' ),\n\t},\n\t{\n\t\tlabel: __( 'Published' ),\n\t\tvalue: 'publish',\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\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\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\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 ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\ticon={ postStatusesInfo[ status ]?.icon }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tpostStatusesInfo[ status ]?.label\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postStatusesInfo[ status ]?.label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\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<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\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\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\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\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\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\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tmaxLength={ 255 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t)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,uBAAuB;kBACvBQ,SAAS,EAAG;gBAAK,CACjB;cAAC,CACE,CACL;YAAA,CACM,CACR,eACD,IAAAzG,WAAA,CAAAgE,GAAA,EAACnE,WAAA,CAAAoE,OAAU,IAAE,CAAC;UAAA,CACP;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEF,IAAAjE,WAAA,CAAAgE,GAAA;MAAKK,SAAS,EAAC,iCAAiC;MAAAF,QAAA,EAC7ClE,gBAAgB,CAAEuB,MAAM,CAAE,EAAEtB;IAAK,CAC/B;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -10,6 +10,7 @@ var _i18n = require("@wordpress/i18n");
10
10
  var _element = require("@wordpress/element");
11
11
  var _components = require("@wordpress/components");
12
12
  var _data = require("@wordpress/data");
13
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
13
14
  var _coreData = require("@wordpress/core-data");
14
15
  var _compose = require("@wordpress/compose");
15
16
  var _a11y = require("@wordpress/a11y");
@@ -53,18 +54,27 @@ const termNamesToIds = (names, terms) => {
53
54
  /**
54
55
  * Renders a flat term selector component.
55
56
  *
56
- * @param {Object} props The component props.
57
- * @param {string} props.slug The slug of the taxonomy.
57
+ * @param {Object} props The component props.
58
+ * @param {string} props.slug The slug of the taxonomy.
59
+ * @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.)
58
60
  *
59
61
  * @return {JSX.Element} The rendered flat term selector component.
60
62
  */
61
63
  function FlatTermSelector({
62
- slug
64
+ slug,
65
+ __nextHasNoMarginBottom
63
66
  }) {
64
67
  var _taxonomy$labels$add_, _taxonomy$labels$sing2;
65
68
  const [values, setValues] = (0, _element.useState)([]);
66
69
  const [search, setSearch] = (0, _element.useState)('');
67
70
  const debouncedSearch = (0, _compose.useDebounce)(setSearch, 500);
71
+ if (!__nextHasNoMarginBottom) {
72
+ (0, _deprecated.default)('Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector', {
73
+ since: '6.7',
74
+ version: '7.0',
75
+ hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.'
76
+ });
77
+ }
68
78
  const {
69
79
  terms,
70
80
  termIds,
@@ -88,7 +98,7 @@ function FlatTermSelector({
88
98
  const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : EMPTY_ARRAY;
89
99
  const query = {
90
100
  ...DEFAULT_QUERY,
91
- include: _termIds.join(','),
101
+ include: _termIds?.join(','),
92
102
  per_page: -1
93
103
  };
94
104
  return {
@@ -96,7 +106,7 @@ function FlatTermSelector({
96
106
  hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
97
107
  taxonomy: _taxonomy,
98
108
  termIds: _termIds,
99
- terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
109
+ terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
100
110
  hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
101
111
  };
102
112
  }, [slug]);
@@ -226,7 +236,8 @@ function FlatTermSelector({
226
236
  added: termAddedLabel,
227
237
  removed: termRemovedLabel,
228
238
  remove: removeTermLabel
229
- }
239
+ },
240
+ __nextHasNoMarginBottom: __nextHasNoMarginBottom
230
241
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_mostUsedTerms.default, {
231
242
  taxonomy: taxonomy,
232
243
  onSelect: appendTerm
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_compose","_a11y","_notices","_store","_terms","_mostUsedTerms","_interopRequireDefault","_jsxRuntime","EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","_fields","context","isSameTermName","termA","termB","unescapeString","toLowerCase","termNamesToIds","names","terms","map","termName","find","term","name","id","filter","undefined","FlatTermSelector","slug","_taxonomy$labels$add_","_taxonomy$labels$sing2","values","setValues","useState","search","setSearch","debouncedSearch","useDebounce","termIds","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","useSelect","select","_post$_links","_post$_links2","getCurrentPost","getEditedPostAttribute","editorStore","getEntityRecords","getTaxonomy","hasFinishedResolution","coreStore","post","_taxonomy","_termIds","rest_base","query","include","join","_links","length","searchResults","useEffect","newValues","suggestions","useMemo","editPost","useDispatch","saveEntityRecord","createErrorNotice","noticesStore","findOrCreateTerm","newTerm","throwOnError","unescapeTerm","error","code","data","term_id","onUpdateTerms","newTermIds","onChange","termNames","availableTerms","uniqueTerms","reduce","acc","some","n","push","newTermNames","Promise","all","then","newTerms","newAvailableTerms","concat","catch","message","type","appendTerm","_taxonomy$labels$sing","includes","defaultName","__","termAddedMessage","sprintf","_x","labels","singular_name","speak","newTermLabel","add_new_item","singularName","termAddedLabel","termRemovedLabel","removeTermLabel","jsxs","Fragment","children","jsx","FormTokenField","__next40pxDefaultSize","value","onInputChange","maxSuggestions","label","messages","added","removed","remove","default","onSelect","_default","exports","withFilters"],"sources":["@wordpress/editor/src/components/post-taxonomies/flat-term-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, withFilters } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unescapeString, unescapeTerm } from '../../utils/terms';\nimport MostUsedTerms from './most-used-terms';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * How the max suggestions limit was chosen:\n * - Matches the `per_page` range set by the REST API.\n * - Can't use \"unbound\" query. The `FormTokenField` needs a fixed number.\n * - Matches default for `FormTokenField`.\n */\nconst MAX_TERMS_SUGGESTIONS = 100;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names\n\t\t.map(\n\t\t\t( termName ) =>\n\t\t\t\tterms.find( ( term ) => isSameTermName( term.name, termName ) )\n\t\t\t\t\t?.id\n\t\t)\n\t\t.filter( ( id ) => id !== undefined );\n};\n\n/**\n * Renders a flat term selector component.\n *\n * @param {Object} props The component props.\n * @param {string} props.slug The slug of the taxonomy.\n *\n * @return {JSX.Element} The rendered flat term selector component.\n */\nexport function FlatTermSelector( { slug } ) {\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tconst {\n\t\tterms,\n\t\ttermIds,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getEntityRecords, getTaxonomy, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst post = getCurrentPost();\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds = _taxonomy\n\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t: EMPTY_ARRAY;\n\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search, slug ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tasync function findOrCreateTerm( term ) {\n\t\ttry {\n\t\t\tconst newTerm = await saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\treturn unescapeTerm( newTerm );\n\t\t} catch ( error ) {\n\t\t\tif ( error.code !== 'term_exists' ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: error.data.term_id,\n\t\t\t\tname: term.name,\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditPost( { [ taxonomy.rest_base ]: newTermIds } );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = termNames.reduce( ( acc, name ) => {\n\t\t\tif (\n\t\t\t\t! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )\n\t\t\t) {\n\t\t\t\tacc.push( name );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! availableTerms.find( ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\tonUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( { name: termName } )\n\t\t\t)\n\t\t)\n\t\t\t.then( ( newTerms ) => {\n\t\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\t\tonUpdateTerms(\n\t\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\t// In case of a failure, try assigning available terms.\n\t\t\t\t// This will invalidate the optimistic update.\n\t\t\t\tonUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );\n\t\t\t} );\n\t}\n\n\tfunction appendTerm( newTerm ) {\n\t\tif ( termIds.includes( newTerm.id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newTermIds = [ ...termIds, newTerm.id ];\n\t\tconst defaultName = slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' );\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: term name. */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\ttaxonomy?.labels?.singular_name ?? defaultName\n\t\t);\n\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tonUpdateTerms( newTermIds );\n\t}\n\n\tconst newTermLabel =\n\t\ttaxonomy?.labels?.add_new_item ??\n\t\t( slug === 'post_tag' ? __( 'Add new tag' ) : __( 'Add new Term' ) );\n\tconst singularName =\n\t\ttaxonomy?.labels?.singular_name ??\n\t\t( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<FormTokenField\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ values }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\tlabel={ newTermLabel }\n\t\t\t\tmessages={ {\n\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )( FlatTermSelector );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,cAAA,GAAAC,sBAAA,CAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AAUA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMa,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAEF,qBAAqB;EAC/BG,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAEC,KAAK,EAAEC,KAAK,KACp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AC9D,CAAC;AAEL;AAAC,IAAAiC,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc,IAAAI,uBAAW,EAAE,yBAA0B,CAAC,CAAE9G,gBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_element","_components","_data","_deprecated","_interopRequireDefault","_coreData","_compose","_a11y","_notices","_store","_terms","_mostUsedTerms","_jsxRuntime","EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","_fields","context","isSameTermName","termA","termB","unescapeString","toLowerCase","termNamesToIds","names","terms","map","termName","find","term","name","id","filter","undefined","FlatTermSelector","slug","__nextHasNoMarginBottom","_taxonomy$labels$add_","_taxonomy$labels$sing2","values","setValues","useState","search","setSearch","debouncedSearch","useDebounce","deprecated","since","version","hint","termIds","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","useSelect","select","_post$_links","_post$_links2","getCurrentPost","getEditedPostAttribute","editorStore","getEntityRecords","getTaxonomy","hasFinishedResolution","coreStore","post","_taxonomy","_termIds","rest_base","query","include","join","_links","length","searchResults","useEffect","newValues","suggestions","useMemo","editPost","useDispatch","saveEntityRecord","createErrorNotice","noticesStore","findOrCreateTerm","newTerm","throwOnError","unescapeTerm","error","code","data","term_id","onUpdateTerms","newTermIds","onChange","termNames","availableTerms","uniqueTerms","reduce","acc","some","n","push","newTermNames","Promise","all","then","newTerms","newAvailableTerms","concat","catch","message","type","appendTerm","_taxonomy$labels$sing","includes","defaultName","__","termAddedMessage","sprintf","_x","labels","singular_name","speak","newTermLabel","add_new_item","singularName","termAddedLabel","termRemovedLabel","removeTermLabel","jsxs","Fragment","children","jsx","FormTokenField","__next40pxDefaultSize","value","onInputChange","maxSuggestions","label","messages","added","removed","remove","default","onSelect","_default","exports","withFilters"],"sources":["@wordpress/editor/src/components/post-taxonomies/flat-term-selector.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, withFilters } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unescapeString, unescapeTerm } from '../../utils/terms';\nimport MostUsedTerms from './most-used-terms';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * How the max suggestions limit was chosen:\n * - Matches the `per_page` range set by the REST API.\n * - Can't use \"unbound\" query. The `FormTokenField` needs a fixed number.\n * - Matches default for `FormTokenField`.\n */\nconst MAX_TERMS_SUGGESTIONS = 100;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names\n\t\t.map(\n\t\t\t( termName ) =>\n\t\t\t\tterms.find( ( term ) => isSameTermName( term.name, termName ) )\n\t\t\t\t\t?.id\n\t\t)\n\t\t.filter( ( id ) => id !== undefined );\n};\n\n/**\n * Renders a flat term selector component.\n *\n * @param {Object} props The component props.\n * @param {string} props.slug The slug of the taxonomy.\n * @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.)\n *\n * @return {JSX.Element} The rendered flat term selector component.\n */\nexport function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector',\n\t\t\t{\n\t\t\t\tsince: '6.7',\n\t\t\t\tversion: '7.0',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst {\n\t\tterms,\n\t\ttermIds,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getEntityRecords, getTaxonomy, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst post = getCurrentPost();\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds = _taxonomy\n\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t: EMPTY_ARRAY;\n\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds?.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds?.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search, slug ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tasync function findOrCreateTerm( term ) {\n\t\ttry {\n\t\t\tconst newTerm = await saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\treturn unescapeTerm( newTerm );\n\t\t} catch ( error ) {\n\t\t\tif ( error.code !== 'term_exists' ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: error.data.term_id,\n\t\t\t\tname: term.name,\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditPost( { [ taxonomy.rest_base ]: newTermIds } );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = termNames.reduce( ( acc, name ) => {\n\t\t\tif (\n\t\t\t\t! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )\n\t\t\t) {\n\t\t\t\tacc.push( name );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! availableTerms.find( ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\tonUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( { name: termName } )\n\t\t\t)\n\t\t)\n\t\t\t.then( ( newTerms ) => {\n\t\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\t\tonUpdateTerms(\n\t\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\t// In case of a failure, try assigning available terms.\n\t\t\t\t// This will invalidate the optimistic update.\n\t\t\t\tonUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );\n\t\t\t} );\n\t}\n\n\tfunction appendTerm( newTerm ) {\n\t\tif ( termIds.includes( newTerm.id ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newTermIds = [ ...termIds, newTerm.id ];\n\t\tconst defaultName = slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' );\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: term name. */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\ttaxonomy?.labels?.singular_name ?? defaultName\n\t\t);\n\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tonUpdateTerms( newTermIds );\n\t}\n\n\tconst newTermLabel =\n\t\ttaxonomy?.labels?.add_new_item ??\n\t\t( slug === 'post_tag' ? __( 'Add new tag' ) : __( 'Add new Term' ) );\n\tconst singularName =\n\t\ttaxonomy?.labels?.singular_name ??\n\t\t( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<FormTokenField\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvalue={ values }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\tlabel={ newTermLabel }\n\t\t\t\tmessages={ {\n\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t} }\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t/>\n\t\t\t<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )( FlatTermSelector );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAP,sBAAA,CAAAL,OAAA;AAA8C,IAAAa,WAAA,GAAAb,OAAA;AAlB9C;AACA;AACA;;AAWA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMc,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAEF,qBAAqB;EAC/BG,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE;AACV,CAAC;AAED,MAAMC,cAAc,GAAGA,CAAEC,KAAK,EAAEC,KAAK,KACpC,IAAAC,qBAAc,EAAEF,KAAM,CAAC,CAACG,WAAW,CAAC,CAAC,KACrC,IAAAD,qBAAc,EAAED,KAAM,CAAC,CAACE,WAAW,CAAC,CAAC;AAEtC,MAAMC,cAAc,GAAGA,CAAEC,KAAK,EAAEC,KAAK,KAAM;EAC1C,OAAOD,KAAK,CACVE,GAAG,CACDC,QAAQ,IACTF,KAAK,CAACG,IAAI,CAAIC,IAAI,IAAMX,cAAc,CAAEW,IAAI,CAACC,IAAI,EAAEH,QAAS,CAAE,CAAC,EAC5DI,EACL,CAAC,CACA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@@ -42,9 +42,15 @@ function PostTaxonomies({
42
42
  taxonomy.types.includes(postType) && taxonomy.visibility?.show_ui);
43
43
  return visibleTaxonomies.map(taxonomy => {
44
44
  const TaxonomyComponent = taxonomy.hierarchical ? _hierarchicalTermSelector.default : _flatTermSelector.default;
45
+ const taxonomyComponentProps = {
46
+ slug: taxonomy.slug,
47
+ ...(taxonomy.hierarchical ? {} : {
48
+ __nextHasNoMarginBottom: true
49
+ })
50
+ };
45
51
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.Fragment, {
46
52
  children: taxonomyWrapper( /*#__PURE__*/(0, _jsxRuntime.jsx)(TaxonomyComponent, {
47
- slug: taxonomy.slug
53
+ ...taxonomyComponentProps
48
54
  }), taxonomy)
49
55
  }, `taxonomy-${taxonomy.slug}`);
50
56
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","_jsxRuntime","identity","x","PostTaxonomies","taxonomyWrapper","postType","taxonomies","useSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","visibleTaxonomies","filter","taxonomy","types","includes","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","jsx","Fragment","children","slug","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( { taxonomyWrapper = identity } ) {\n\tconst { postType, taxonomies } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t}, [] );\n\tconst visibleTaxonomies = ( taxonomies ?? [] ).filter(\n\t\t( taxonomy ) =>\n\t\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t\ttaxonomy.types.includes( postType ) && taxonomy.visibility?.show_ui\n\t);\n\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\n/**\n * Renders the taxonomies associated with a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component.\n *\n * @return {Array} An array of JSX elements representing the visible taxonomies.\n */\nexport default PostTaxonomies;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAZnD;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMQ,QAAQ,GAAKC,CAAC,IAAMA,CAAC;AAEpB,SAASC,cAAcA,CAAE;EAAEC,eAAe,GAAGH;AAAS,CAAC,EAAG;EAChE,MAAM;IAAEI,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;MACpDJ,UAAU,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,aAAa,CAAE;QAAEC,QAAQ,EAAE,CAAC;MAAE,CAAE;IACjE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,iBAAiB,GAAG,CAAER,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE,EAAGS,MAAM,CAClDC,QAAQ;EACT;EACA;EACAA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEb,QAAS,CAAC,IAAIW,QAAQ,CAACG,UAAU,EAAEC,OAC9D,CAAC;EAED,OAAON,iBAAiB,CAACO,GAAG,CAAIL,QAAQ,IAAM;IAC7C,MAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAY,GAC5CC,iCAAwB,GACxBC,yBAAgB;IACnB,oBACC,IAAAzB,WAAA,CAAA0B,GAAA,EAAClC,QAAA,CAAAmC,QAAQ;MAAAC,QAAA,EACNxB,eAAe,eAChB,IAAAJ,WAAA,CAAA0B,GAAA,EAACJ,iBAAiB;QAACO,IAAI,EAAGb,QAAQ,CAACa;MAAM,CAAE,CAAC,EAC5Cb,QACD;IAAC,GAJe,YAAYA,QAAQ,CAACa,IAAM,EAKlC,CAAC;EAEb,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe7B,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","_jsxRuntime","identity","x","PostTaxonomies","taxonomyWrapper","postType","taxonomies","useSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","visibleTaxonomies","filter","taxonomy","types","includes","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","taxonomyComponentProps","slug","__nextHasNoMarginBottom","jsx","Fragment","children","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( { taxonomyWrapper = identity } ) {\n\tconst { postType, taxonomies } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t}, [] );\n\tconst visibleTaxonomies = ( taxonomies ?? [] ).filter(\n\t\t( taxonomy ) =>\n\t\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t\ttaxonomy.types.includes( postType ) && taxonomy.visibility?.show_ui\n\t);\n\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\tconst taxonomyComponentProps = {\n\t\t\tslug: taxonomy.slug,\n\t\t\t...( taxonomy.hierarchical\n\t\t\t\t? {}\n\t\t\t\t: { __nextHasNoMarginBottom: true } ),\n\t\t};\n\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent { ...taxonomyComponentProps } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\n/**\n * Renders the taxonomies associated with a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component.\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AQ,CAACO,YAAY,GACvB,CAAC,CAAC,GACF;QAAEK,uBAAuB,EAAE;MAAK,CAAC;IACrC,CAAC;IAED,oBACC,IAAA5B,WAAA,CAAA6B,GAAA,EAACrC,QAAA,CAAAsC,QAAQ;MAAAC,QAAA,EACN3B,eAAe,eAChB,IAAAJ,WAAA,CAAA6B,GAAA,EAACP,iBAAiB;QAAA,GAAMI;MAAsB,CAAI,CAAC,EACnDV,QACD;IAAC,GAJe,YAAYA,QAAQ,CAACW,IAAM,EAKlC,CAAC;EAEb,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe/B,cAAc","ignoreList":[]}
@@ -61,10 +61,10 @@ function BlockThemeControl({
61
61
  const {
62
62
  setRenderingMode
63
63
  } = (0, _data.useDispatch)(_store.store);
64
- const canCreateTemplate = (0, _data.useSelect)(select => {
65
- var _select$canUser;
66
- return (_select$canUser = select(_coreData.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
67
- });
64
+ const canCreateTemplate = (0, _data.useSelect)(select => !!select(_coreData.store).canUser('create', {
65
+ kind: 'postType',
66
+ name: 'wp_template'
67
+ }), []);
68
68
  if (!hasResolved) {
69
69
  return null;
70
70
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","canCreateTemplate","_select$canUser","coreStore","canUser","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","jsx","DropdownMenu","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","type","actions","default","check","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\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\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\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} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,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B,CAClB,IAAAU,QAAE,EACD,uFACD,CAAC,EACD;cACCwB,IAAI,EAAE,UAAU;cAChBC,OAAO,EAAE3B;YACV,CACD,CAAC;UACF,CAAG;UAAAkB,QAAA,EAED,IAAAhB,QAAE,EAAE,eAAgB;QAAC,CACd,CACV,eAED,IAAAhC,WAAA,CAAAoC,GAAA,EAACzC,mBAAA,CAAA+D,OAAkB;UAACzB,OAAO,EAAGgB;QAAS,CAAE,CAAC,eAC1C,IAAAjD,WAAA,CAAAoC,GAAA,EAACvC,qBAAA,CAAA6D,OAAoB;UAACzB,OAAO,EAAGgB;QAAS,CAAE,CAAC,EAC1CvB,iBAAiB,iBAClB,IAAA1B,WAAA,CAAAoC,GAAA,EAACrC,kBAAA,CAAA2D,OAAiB;UAACzB,OAAO,EAAGgB;QAAS,CAAE,CACxC;MAAA,CACS,CAAC,eACZ,IAAAjD,WAAA,CAAAoC,GAAA,EAAC/C,WAAA,CAAA+D,SAAS;QAAAJ,QAAA,eACT,IAAAhD,WAAA,CAAAoC,GAAA,EAAC/C,WAAA,CAAAgE,QAAQ;UACRN,IAAI,EAAG,CAAEzC,gBAAgB,GAAGqD,YAAK,GAAGxB,SAAW;UAC/CyB,UAAU,EAAG,CAAEtD,gBAAkB;UACjCuD,IAAI,EAAC,kBAAkB;UACvB5B,OAAO,EAAGA,CAAA,KAAM;YACfR,gBAAgB,CACfnB,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;UACF,CAAG;UAAA0C,QAAA,EAED,IAAAhB,QAAE,EAAE,eAAgB;QAAC,CACd;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","jsx","DropdownMenu","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","type","actions","default","check","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\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\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\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} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAA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C;AAEjB","ignoreList":[]}
@@ -42,7 +42,10 @@ function PostTemplateToggle({
42
42
  if (!supportsTemplateMode && availableTemplates[templateSlug]) {
43
43
  return availableTemplates[templateSlug];
44
44
  }
45
- const template = select(_coreData.store).canUser('create', 'templates') && select(_store.store).getCurrentTemplateId();
45
+ const template = select(_coreData.store).canUser('create', {
46
+ kind: 'postType',
47
+ name: 'wp_template'
48
+ }) && select(_store.store).getCurrentTemplateId();
46
49
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
47
50
  }, []);
48
51
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
@@ -83,7 +86,10 @@ function PostTemplateDropdownContent({
83
86
  getEntityRecords
84
87
  } = select(_coreData.store);
85
88
  const editorSettings = select(_store.store).getEditorSettings();
86
- const canCreateTemplates = canUser('create', 'templates');
89
+ const canCreateTemplates = canUser('create', {
90
+ kind: 'postType',
91
+ name: 'wp_template'
92
+ });
87
93
  const _currentTemplateId = select(_store.store).getCurrentTemplateId();
88
94
  return {
89
95
  availableTemplates: editorSettings.availableTemplates,