@wordpress/editor 14.2.0 → 14.4.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 (882) 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 +26 -13
  6. package/build/bindings/pattern-overrides.js.map +1 -1
  7. package/build/bindings/post-meta.js +27 -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 +6 -2
  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/editor-interface/index.js +2 -1
  16. package/build/components/editor-interface/index.js.map +1 -1
  17. package/build/components/entities-saved-states/index.js +1 -1
  18. package/build/components/entities-saved-states/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 +19 -17
  24. package/build/components/header/index.js.map +1 -1
  25. package/build/components/inserter-sidebar/index.js +10 -21
  26. package/build/components/inserter-sidebar/index.js.map +1 -1
  27. package/build/components/list-view-sidebar/index.js +19 -47
  28. package/build/components/list-view-sidebar/index.js.map +1 -1
  29. package/build/components/page-attributes/order.js +1 -67
  30. package/build/components/page-attributes/order.js.map +1 -1
  31. package/build/components/page-attributes/panel.js +1 -4
  32. package/build/components/page-attributes/panel.js.map +1 -1
  33. package/build/components/page-attributes/parent.js +2 -1
  34. package/build/components/page-attributes/parent.js.map +1 -1
  35. package/build/components/post-actions/actions.js +189 -244
  36. package/build/components/post-actions/actions.js.map +1 -1
  37. package/build/components/post-actions/index.js +1 -1
  38. package/build/components/post-actions/index.js.map +1 -1
  39. package/build/components/post-card-panel/index.js +8 -2
  40. package/build/components/post-card-panel/index.js.map +1 -1
  41. package/build/components/post-comments/index.js +1 -1
  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 +2 -2
  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-preview-button/index.js +1 -1
  54. package/build/components/post-preview-button/index.js.map +1 -1
  55. package/build/components/post-publish-button/index.js +4 -11
  56. package/build/components/post-publish-button/index.js.map +1 -1
  57. package/build/components/post-publish-panel/index.js +1 -1
  58. package/build/components/post-publish-panel/index.js.map +1 -1
  59. package/build/components/post-publish-panel/maybe-category-panel.js +4 -1
  60. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  61. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -1
  62. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  63. package/build/components/post-saved-state/index.js +11 -1
  64. package/build/components/post-saved-state/index.js.map +1 -1
  65. package/build/components/post-schedule/index.js +3 -0
  66. package/build/components/post-schedule/index.js.map +1 -1
  67. package/build/components/post-status/index.js +32 -11
  68. package/build/components/post-status/index.js.map +1 -1
  69. package/build/components/post-taxonomies/flat-term-selector.js +17 -6
  70. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  71. package/build/components/post-taxonomies/index.js +7 -1
  72. package/build/components/post-taxonomies/index.js.map +1 -1
  73. package/build/components/post-template/block-theme.js +4 -4
  74. package/build/components/post-template/block-theme.js.map +1 -1
  75. package/build/components/post-template/classic-theme.js +8 -2
  76. package/build/components/post-template/classic-theme.js.map +1 -1
  77. package/build/components/post-template/create-new-template.js +4 -1
  78. package/build/components/post-template/create-new-template.js.map +1 -1
  79. package/build/components/post-template/hooks.js +5 -1
  80. package/build/components/post-template/hooks.js.map +1 -1
  81. package/build/components/post-template/panel.js +8 -2
  82. package/build/components/post-template/panel.js.map +1 -1
  83. package/build/components/post-title/index.js +5 -13
  84. package/build/components/post-title/index.js.map +1 -1
  85. package/build/components/post-trash/check.js +6 -4
  86. package/build/components/post-trash/check.js.map +1 -1
  87. package/build/components/post-url/panel.js +6 -2
  88. package/build/components/post-url/panel.js.map +1 -1
  89. package/build/components/posts-per-page/index.js +6 -2
  90. package/build/components/posts-per-page/index.js.map +1 -1
  91. package/build/components/preview-dropdown/index.js +1 -1
  92. package/build/components/preview-dropdown/index.js.map +1 -1
  93. package/build/components/provider/index.native.js +0 -4
  94. package/build/components/provider/index.native.js.map +1 -1
  95. package/build/components/provider/use-block-editor-settings.js +21 -9
  96. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  97. package/build/components/save-publish-panels/index.js +30 -17
  98. package/build/components/save-publish-panels/index.js.map +1 -1
  99. package/build/components/sidebar/index.js +3 -7
  100. package/build/components/sidebar/index.js.map +1 -1
  101. package/build/components/sidebar/post-summary.js +1 -2
  102. package/build/components/sidebar/post-summary.js.map +1 -1
  103. package/build/components/site-discussion/index.js +7 -3
  104. package/build/components/site-discussion/index.js.map +1 -1
  105. package/build/components/template-content-panel/index.js +28 -3
  106. package/build/components/template-content-panel/index.js.map +1 -1
  107. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -4
  108. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  109. package/build/components/visual-editor/index.js +6 -3
  110. package/build/components/visual-editor/index.js.map +1 -1
  111. package/build/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  112. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  113. package/build/dataviews/actions/delete-post.js +98 -0
  114. package/build/dataviews/actions/delete-post.js.map +1 -0
  115. package/build/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +11 -20
  116. package/build/dataviews/actions/export-pattern.js.map +1 -0
  117. package/build/dataviews/actions/index.js +32 -0
  118. package/build/dataviews/actions/index.js.map +1 -0
  119. package/build/dataviews/actions/reset-post.js +111 -0
  120. package/build/dataviews/actions/reset-post.js.map +1 -0
  121. package/build/dataviews/actions/utils.js +50 -0
  122. package/build/dataviews/actions/utils.js.map +1 -0
  123. package/build/dataviews/store/private-actions.js.map +1 -1
  124. package/build/dataviews/store/private-selectors.js +6 -6
  125. package/build/dataviews/store/private-selectors.js.map +1 -1
  126. package/build/dataviews/store/reducer.js +6 -2
  127. package/build/dataviews/store/reducer.js.map +1 -1
  128. package/build/dataviews/types.js +6 -0
  129. package/build/dataviews/types.js.map +1 -0
  130. package/build/hooks/pattern-overrides.js +3 -3
  131. package/build/hooks/pattern-overrides.js.map +1 -1
  132. package/build/index.js +0 -1
  133. package/build/index.js.map +1 -1
  134. package/build/private-apis.js +5 -0
  135. package/build/private-apis.js.map +1 -1
  136. package/build/private-apis.native.js +0 -2
  137. package/build/private-apis.native.js.map +1 -1
  138. package/build/store/constants.js.map +1 -1
  139. package/build/store/private-actions.js +1 -1
  140. package/build/store/private-actions.js.map +1 -1
  141. package/build/store/private-selectors.js +0 -18
  142. package/build/store/private-selectors.js.map +1 -1
  143. package/build/store/utils/is-template-revertable.js +6 -8
  144. package/build/store/utils/is-template-revertable.js.map +1 -1
  145. package/build/utils/media-upload/index.js +35 -2
  146. package/build/utils/media-upload/index.js.map +1 -1
  147. package/build-module/bindings/api.js +57 -0
  148. package/build-module/bindings/api.js.map +1 -0
  149. package/build-module/bindings/pattern-overrides.js +26 -13
  150. package/build-module/bindings/pattern-overrides.js.map +1 -1
  151. package/build-module/bindings/post-meta.js +27 -12
  152. package/build-module/bindings/post-meta.js.map +1 -1
  153. package/build-module/components/block-settings-menu/content-only-settings-menu.js +4 -1
  154. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  155. package/build-module/components/blog-title/index.js +6 -2
  156. package/build-module/components/blog-title/index.js.map +1 -1
  157. package/build-module/components/collapsible-block-toolbar/index.js +1 -2
  158. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  159. package/build-module/components/editor-interface/index.js +2 -1
  160. package/build-module/components/editor-interface/index.js.map +1 -1
  161. package/build-module/components/entities-saved-states/index.js +1 -1
  162. package/build-module/components/entities-saved-states/index.js.map +1 -1
  163. package/build-module/components/global-styles-provider/index.js +15 -3
  164. package/build-module/components/global-styles-provider/index.js.map +1 -1
  165. package/build-module/components/header/back-button.js +5 -7
  166. package/build-module/components/header/back-button.js.map +1 -1
  167. package/build-module/components/header/index.js +19 -19
  168. package/build-module/components/header/index.js.map +1 -1
  169. package/build-module/components/inserter-sidebar/index.js +11 -22
  170. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  171. package/build-module/components/list-view-sidebar/index.js +20 -49
  172. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  173. package/build-module/components/page-attributes/order.js +4 -70
  174. package/build-module/components/page-attributes/order.js.map +1 -1
  175. package/build-module/components/page-attributes/panel.js +1 -6
  176. package/build-module/components/page-attributes/panel.js.map +1 -1
  177. package/build-module/components/page-attributes/parent.js +2 -1
  178. package/build-module/components/page-attributes/parent.js.map +1 -1
  179. package/build-module/components/post-actions/actions.js +186 -240
  180. package/build-module/components/post-actions/actions.js.map +1 -1
  181. package/build-module/components/post-actions/index.js +1 -1
  182. package/build-module/components/post-actions/index.js.map +1 -1
  183. package/build-module/components/post-card-panel/index.js +8 -2
  184. package/build-module/components/post-card-panel/index.js.map +1 -1
  185. package/build-module/components/post-comments/index.js +2 -2
  186. package/build-module/components/post-comments/index.js.map +1 -1
  187. package/build-module/components/post-content-information/index.js +7 -1
  188. package/build-module/components/post-content-information/index.js.map +1 -1
  189. package/build-module/components/post-discussion/panel.js +3 -3
  190. package/build-module/components/post-discussion/panel.js.map +1 -1
  191. package/build-module/components/post-excerpt/panel.js +2 -2
  192. package/build-module/components/post-excerpt/panel.js.map +1 -1
  193. package/build-module/components/post-featured-image/index.js +3 -1
  194. package/build-module/components/post-featured-image/index.js.map +1 -1
  195. package/build-module/components/post-last-revision/index.js +2 -1
  196. package/build-module/components/post-last-revision/index.js.map +1 -1
  197. package/build-module/components/post-preview-button/index.js +1 -1
  198. package/build-module/components/post-preview-button/index.js.map +1 -1
  199. package/build-module/components/post-publish-button/index.js +4 -11
  200. package/build-module/components/post-publish-button/index.js.map +1 -1
  201. package/build-module/components/post-publish-panel/index.js +1 -1
  202. package/build-module/components/post-publish-panel/index.js.map +1 -1
  203. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -1
  204. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  205. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -1
  206. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  207. package/build-module/components/post-saved-state/index.js +11 -1
  208. package/build-module/components/post-saved-state/index.js.map +1 -1
  209. package/build-module/components/post-schedule/index.js +3 -0
  210. package/build-module/components/post-schedule/index.js.map +1 -1
  211. package/build-module/components/post-status/index.js +31 -11
  212. package/build-module/components/post-status/index.js.map +1 -1
  213. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -6
  214. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  215. package/build-module/components/post-taxonomies/index.js +7 -1
  216. package/build-module/components/post-taxonomies/index.js.map +1 -1
  217. package/build-module/components/post-template/block-theme.js +4 -4
  218. package/build-module/components/post-template/block-theme.js.map +1 -1
  219. package/build-module/components/post-template/classic-theme.js +8 -2
  220. package/build-module/components/post-template/classic-theme.js.map +1 -1
  221. package/build-module/components/post-template/create-new-template.js +4 -1
  222. package/build-module/components/post-template/create-new-template.js.map +1 -1
  223. package/build-module/components/post-template/hooks.js +5 -1
  224. package/build-module/components/post-template/hooks.js.map +1 -1
  225. package/build-module/components/post-template/panel.js +8 -2
  226. package/build-module/components/post-template/panel.js.map +1 -1
  227. package/build-module/components/post-title/index.js +5 -13
  228. package/build-module/components/post-title/index.js.map +1 -1
  229. package/build-module/components/post-trash/check.js +6 -4
  230. package/build-module/components/post-trash/check.js.map +1 -1
  231. package/build-module/components/post-url/panel.js +6 -2
  232. package/build-module/components/post-url/panel.js.map +1 -1
  233. package/build-module/components/posts-per-page/index.js +6 -2
  234. package/build-module/components/posts-per-page/index.js.map +1 -1
  235. package/build-module/components/preview-dropdown/index.js +1 -1
  236. package/build-module/components/preview-dropdown/index.js.map +1 -1
  237. package/build-module/components/provider/index.native.js +0 -4
  238. package/build-module/components/provider/index.native.js.map +1 -1
  239. package/build-module/components/provider/use-block-editor-settings.js +21 -9
  240. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  241. package/build-module/components/save-publish-panels/index.js +30 -17
  242. package/build-module/components/save-publish-panels/index.js.map +1 -1
  243. package/build-module/components/sidebar/index.js +3 -7
  244. package/build-module/components/sidebar/index.js.map +1 -1
  245. package/build-module/components/sidebar/post-summary.js +1 -2
  246. package/build-module/components/sidebar/post-summary.js.map +1 -1
  247. package/build-module/components/site-discussion/index.js +8 -4
  248. package/build-module/components/site-discussion/index.js.map +1 -1
  249. package/build-module/components/template-content-panel/index.js +29 -4
  250. package/build-module/components/template-content-panel/index.js.map +1 -1
  251. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -4
  252. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  253. package/build-module/components/visual-editor/index.js +6 -3
  254. package/build-module/components/visual-editor/index.js.map +1 -1
  255. package/build-module/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  256. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  257. package/build-module/dataviews/actions/delete-post.js +89 -0
  258. package/build-module/dataviews/actions/delete-post.js.map +1 -0
  259. package/build-module/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +10 -19
  260. package/build-module/dataviews/actions/export-pattern.js.map +1 -0
  261. package/build-module/dataviews/actions/index.js +24 -0
  262. package/build-module/dataviews/actions/index.js.map +1 -0
  263. package/build-module/dataviews/actions/reset-post.js +104 -0
  264. package/build-module/dataviews/actions/reset-post.js.map +1 -0
  265. package/build-module/dataviews/actions/utils.js +41 -0
  266. package/build-module/dataviews/actions/utils.js.map +1 -0
  267. package/build-module/dataviews/store/private-actions.js.map +1 -1
  268. package/build-module/dataviews/store/private-selectors.js +5 -5
  269. package/build-module/dataviews/store/private-selectors.js.map +1 -1
  270. package/build-module/dataviews/store/reducer.js +6 -2
  271. package/build-module/dataviews/store/reducer.js.map +1 -1
  272. package/build-module/dataviews/types.js +2 -0
  273. package/build-module/dataviews/types.js.map +1 -0
  274. package/build-module/hooks/pattern-overrides.js +4 -2
  275. package/build-module/hooks/pattern-overrides.js.map +1 -1
  276. package/build-module/index.js +0 -1
  277. package/build-module/index.js.map +1 -1
  278. package/build-module/private-apis.js +5 -0
  279. package/build-module/private-apis.js.map +1 -1
  280. package/build-module/private-apis.native.js +0 -2
  281. package/build-module/private-apis.native.js.map +1 -1
  282. package/build-module/store/constants.js.map +1 -1
  283. package/build-module/store/private-actions.js +1 -1
  284. package/build-module/store/private-actions.js.map +1 -1
  285. package/build-module/store/private-selectors.js +0 -17
  286. package/build-module/store/private-selectors.js.map +1 -1
  287. package/build-module/store/utils/is-template-revertable.js +6 -8
  288. package/build-module/store/utils/is-template-revertable.js.map +1 -1
  289. package/build-module/utils/media-upload/index.js +36 -3
  290. package/build-module/utils/media-upload/index.js.map +1 -1
  291. package/build-style/style-rtl.css +93 -95
  292. package/build-style/style.css +93 -95
  293. package/build-types/bindings/api.d.ts +25 -0
  294. package/build-types/bindings/api.d.ts.map +1 -0
  295. package/build-types/bindings/pattern-overrides.d.ts +17 -0
  296. package/build-types/bindings/pattern-overrides.d.ts.map +1 -0
  297. package/build-types/bindings/post-meta.d.ts +23 -0
  298. package/build-types/bindings/post-meta.d.ts.map +1 -0
  299. package/build-types/components/autocompleters/index.d.ts +2 -0
  300. package/build-types/components/autocompleters/index.d.ts.map +1 -0
  301. package/build-types/components/autocompleters/user.d.ts +6 -0
  302. package/build-types/components/autocompleters/user.d.ts.map +1 -0
  303. package/build-types/components/autosave-monitor/index.d.ts +15 -0
  304. package/build-types/components/autosave-monitor/index.d.ts.map +1 -0
  305. package/build-types/components/block-manager/category.d.ts +6 -0
  306. package/build-types/components/block-manager/category.d.ts.map +1 -0
  307. package/build-types/components/block-manager/checklist.d.ts +7 -0
  308. package/build-types/components/block-manager/checklist.d.ts.map +1 -0
  309. package/build-types/components/block-manager/index.d.ts +3 -0
  310. package/build-types/components/block-manager/index.d.ts.map +1 -0
  311. package/build-types/components/block-removal-warnings/index.d.ts +2 -0
  312. package/build-types/components/block-removal-warnings/index.d.ts.map +1 -0
  313. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +2 -0
  314. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -0
  315. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts +65 -0
  316. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -0
  317. package/build-types/components/blog-title/index.d.ts +2 -0
  318. package/build-types/components/blog-title/index.d.ts.map +1 -0
  319. package/build-types/components/character-count/index.d.ts +7 -0
  320. package/build-types/components/character-count/index.d.ts.map +1 -0
  321. package/build-types/components/collapsible-block-toolbar/index.d.ts +5 -0
  322. package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -0
  323. package/build-types/components/commands/index.d.ts +2 -0
  324. package/build-types/components/commands/index.d.ts.map +1 -0
  325. package/build-types/components/create-template-part-modal/index.d.ts +14 -0
  326. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -0
  327. package/build-types/components/create-template-part-modal/utils.d.ts +4 -0
  328. package/build-types/components/create-template-part-modal/utils.d.ts.map +1 -0
  329. package/build-types/components/deprecated.d.ts +182 -0
  330. package/build-types/components/deprecated.d.ts.map +1 -0
  331. package/build-types/components/document-bar/index.d.ts +22 -0
  332. package/build-types/components/document-bar/index.d.ts.map +1 -0
  333. package/build-types/components/document-outline/check.d.ts +12 -0
  334. package/build-types/components/document-outline/check.d.ts.map +1 -0
  335. package/build-types/components/document-outline/index.d.ts +16 -0
  336. package/build-types/components/document-outline/index.d.ts.map +1 -0
  337. package/build-types/components/document-outline/item.d.ts +9 -0
  338. package/build-types/components/document-outline/item.d.ts.map +1 -0
  339. package/build-types/components/document-tools/index.d.ts +6 -0
  340. package/build-types/components/document-tools/index.d.ts.map +1 -0
  341. package/build-types/components/editor/index.d.ts +14 -0
  342. package/build-types/components/editor/index.d.ts.map +1 -0
  343. package/build-types/components/editor-history/redo.d.ts +4 -0
  344. package/build-types/components/editor-history/redo.d.ts.map +1 -0
  345. package/build-types/components/editor-history/undo.d.ts +4 -0
  346. package/build-types/components/editor-history/undo.d.ts.map +1 -0
  347. package/build-types/components/editor-interface/content-slot-fill.d.ts +3 -0
  348. package/build-types/components/editor-interface/content-slot-fill.d.ts.map +1 -0
  349. package/build-types/components/editor-interface/index.d.ts +17 -0
  350. package/build-types/components/editor-interface/index.d.ts.map +1 -0
  351. package/build-types/components/editor-notices/index.d.ts +13 -0
  352. package/build-types/components/editor-notices/index.d.ts.map +1 -0
  353. package/build-types/components/editor-snackbars/index.d.ts +7 -0
  354. package/build-types/components/editor-snackbars/index.d.ts.map +1 -0
  355. package/build-types/components/entities-saved-states/entity-record-item.d.ts +6 -0
  356. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -0
  357. package/build-types/components/entities-saved-states/entity-type-list.d.ts +6 -0
  358. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -0
  359. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts +2 -0
  360. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -0
  361. package/build-types/components/entities-saved-states/index.d.ts +43 -0
  362. package/build-types/components/entities-saved-states/index.d.ts.map +1 -0
  363. package/build-types/components/error-boundary/index.d.ts +14 -0
  364. package/build-types/components/error-boundary/index.d.ts.map +1 -0
  365. package/build-types/components/global-keyboard-shortcuts/index.d.ts +9 -0
  366. package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -0
  367. package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts +8 -0
  368. package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts.map +1 -0
  369. package/build-types/components/global-styles-provider/index.d.ts +20 -0
  370. package/build-types/components/global-styles-provider/index.d.ts.map +1 -0
  371. package/build-types/components/header/back-button.d.ts +7 -0
  372. package/build-types/components/header/back-button.d.ts.map +1 -0
  373. package/build-types/components/header/index.d.ts +10 -0
  374. package/build-types/components/header/index.d.ts.map +1 -0
  375. package/build-types/components/index.d.ts +108 -0
  376. package/build-types/components/index.d.ts.map +1 -0
  377. package/build-types/components/inserter-sidebar/index.d.ts +2 -0
  378. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -0
  379. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +26 -0
  380. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
  381. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
  382. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
  383. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +3 -0
  384. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
  385. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +8 -0
  386. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
  387. package/build-types/components/list-view-sidebar/index.d.ts +2 -0
  388. package/build-types/components/list-view-sidebar/index.d.ts.map +1 -0
  389. package/build-types/components/list-view-sidebar/list-view-outline.d.ts +2 -0
  390. package/build-types/components/list-view-sidebar/list-view-outline.d.ts.map +1 -0
  391. package/build-types/components/local-autosave-monitor/index.d.ts +3 -0
  392. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -0
  393. package/build-types/components/media-categories/index.d.ts +7 -0
  394. package/build-types/components/media-categories/index.d.ts.map +1 -0
  395. package/build-types/components/mode-switcher/index.d.ts +3 -0
  396. package/build-types/components/mode-switcher/index.d.ts.map +1 -0
  397. package/build-types/components/more-menu/copy-content-menu-item.d.ts +2 -0
  398. package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -0
  399. package/build-types/components/more-menu/index.d.ts +2 -0
  400. package/build-types/components/more-menu/index.d.ts.map +1 -0
  401. package/build-types/components/more-menu/tools-more-menu-group.d.ts +6 -0
  402. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -0
  403. package/build-types/components/more-menu/view-more-menu-group.d.ts +6 -0
  404. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -0
  405. package/build-types/components/page-attributes/check.d.ts +13 -0
  406. package/build-types/components/page-attributes/check.d.ts.map +1 -0
  407. package/build-types/components/page-attributes/order.d.ts +9 -0
  408. package/build-types/components/page-attributes/order.d.ts.map +1 -0
  409. package/build-types/components/page-attributes/panel.d.ts +7 -0
  410. package/build-types/components/page-attributes/panel.d.ts.map +1 -0
  411. package/build-types/components/page-attributes/parent.d.ts +11 -0
  412. package/build-types/components/page-attributes/parent.d.ts.map +1 -0
  413. package/build-types/components/pattern-duplicate-modal/index.d.ts +3 -0
  414. package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -0
  415. package/build-types/components/pattern-overrides-panel/index.d.ts +2 -0
  416. package/build-types/components/pattern-overrides-panel/index.d.ts.map +1 -0
  417. package/build-types/components/pattern-rename-modal/index.d.ts +3 -0
  418. package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -0
  419. package/build-types/components/plugin-document-setting-panel/index.d.ts +69 -0
  420. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -0
  421. package/build-types/components/plugin-more-menu-item/index.d.ts +3 -0
  422. package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -0
  423. package/build-types/components/plugin-post-publish-panel/index.d.ts +47 -0
  424. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -0
  425. package/build-types/components/plugin-post-status-info/index.d.ts +57 -0
  426. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -0
  427. package/build-types/components/plugin-pre-publish-panel/index.d.ts +50 -0
  428. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -0
  429. package/build-types/components/plugin-sidebar/index.d.ts +73 -0
  430. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -0
  431. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts +52 -0
  432. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -0
  433. package/build-types/components/post-actions/actions.d.ts +31 -0
  434. package/build-types/components/post-actions/actions.d.ts.map +1 -0
  435. package/build-types/components/post-actions/index.d.ts +5 -0
  436. package/build-types/components/post-actions/index.d.ts.map +1 -0
  437. package/build-types/components/post-author/check.d.ts +13 -0
  438. package/build-types/components/post-author/check.d.ts.map +1 -0
  439. package/build-types/components/post-author/combobox.d.ts +2 -0
  440. package/build-types/components/post-author/combobox.d.ts.map +1 -0
  441. package/build-types/components/post-author/constants.d.ts +9 -0
  442. package/build-types/components/post-author/constants.d.ts.map +1 -0
  443. package/build-types/components/post-author/hook.d.ts +6 -0
  444. package/build-types/components/post-author/hook.d.ts.map +1 -0
  445. package/build-types/components/post-author/index.d.ts +8 -0
  446. package/build-types/components/post-author/index.d.ts.map +1 -0
  447. package/build-types/components/post-author/panel.d.ts +8 -0
  448. package/build-types/components/post-author/panel.d.ts.map +1 -0
  449. package/build-types/components/post-author/select.d.ts +2 -0
  450. package/build-types/components/post-author/select.d.ts.map +1 -0
  451. package/build-types/components/post-card-panel/index.d.ts +4 -0
  452. package/build-types/components/post-card-panel/index.d.ts.map +1 -0
  453. package/build-types/components/post-comments/index.d.ts +3 -0
  454. package/build-types/components/post-comments/index.d.ts.map +1 -0
  455. package/build-types/components/post-content-information/index.d.ts +2 -0
  456. package/build-types/components/post-content-information/index.d.ts.map +1 -0
  457. package/build-types/components/post-discussion/panel.d.ts +10 -0
  458. package/build-types/components/post-discussion/panel.d.ts.map +1 -0
  459. package/build-types/components/post-excerpt/check.d.ts +13 -0
  460. package/build-types/components/post-excerpt/check.d.ts.map +1 -0
  461. package/build-types/components/post-excerpt/index.d.ts +15 -0
  462. package/build-types/components/post-excerpt/index.d.ts.map +1 -0
  463. package/build-types/components/post-excerpt/panel.d.ts +8 -0
  464. package/build-types/components/post-excerpt/panel.d.ts.map +1 -0
  465. package/build-types/components/post-excerpt/plugin.d.ts +53 -0
  466. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -0
  467. package/build-types/components/post-featured-image/check.d.ts +14 -0
  468. package/build-types/components/post-featured-image/check.d.ts.map +1 -0
  469. package/build-types/components/post-featured-image/index.d.ts +3 -0
  470. package/build-types/components/post-featured-image/index.d.ts.map +1 -0
  471. package/build-types/components/post-featured-image/panel.d.ts +13 -0
  472. package/build-types/components/post-featured-image/panel.d.ts.map +1 -0
  473. package/build-types/components/post-format/check.d.ts +5 -0
  474. package/build-types/components/post-format/check.d.ts.map +1 -0
  475. package/build-types/components/post-format/index.d.ts +16 -0
  476. package/build-types/components/post-format/index.d.ts.map +1 -0
  477. package/build-types/components/post-format/panel.d.ts +8 -0
  478. package/build-types/components/post-format/panel.d.ts.map +1 -0
  479. package/build-types/components/post-last-edited-panel/index.d.ts +2 -0
  480. package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -0
  481. package/build-types/components/post-last-revision/check.d.ts +13 -0
  482. package/build-types/components/post-last-revision/check.d.ts.map +1 -0
  483. package/build-types/components/post-last-revision/index.d.ts +9 -0
  484. package/build-types/components/post-last-revision/index.d.ts.map +1 -0
  485. package/build-types/components/post-last-revision/panel.d.ts +8 -0
  486. package/build-types/components/post-last-revision/panel.d.ts.map +1 -0
  487. package/build-types/components/post-locked-modal/index.d.ts +8 -0
  488. package/build-types/components/post-locked-modal/index.d.ts.map +1 -0
  489. package/build-types/components/post-panel-row/index.d.ts +3 -0
  490. package/build-types/components/post-panel-row/index.d.ts.map +1 -0
  491. package/build-types/components/post-panel-section/index.d.ts +6 -0
  492. package/build-types/components/post-panel-section/index.d.ts.map +1 -0
  493. package/build-types/components/post-pending-status/check.d.ts +15 -0
  494. package/build-types/components/post-pending-status/check.d.ts.map +1 -0
  495. package/build-types/components/post-pending-status/index.d.ts +8 -0
  496. package/build-types/components/post-pending-status/index.d.ts.map +1 -0
  497. package/build-types/components/post-pingbacks/index.d.ts +3 -0
  498. package/build-types/components/post-pingbacks/index.d.ts.map +1 -0
  499. package/build-types/components/post-preview-button/index.d.ts +23 -0
  500. package/build-types/components/post-preview-button/index.d.ts.map +1 -0
  501. package/build-types/components/post-publish-button/index.d.ts +17 -0
  502. package/build-types/components/post-publish-button/index.d.ts.map +1 -0
  503. package/build-types/components/post-publish-button/label.d.ts +7 -0
  504. package/build-types/components/post-publish-button/label.d.ts.map +1 -0
  505. package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts +17 -0
  506. package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -0
  507. package/build-types/components/post-publish-panel/index.d.ts +10 -0
  508. package/build-types/components/post-publish-panel/index.d.ts.map +1 -0
  509. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts +3 -0
  510. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -0
  511. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts +2 -0
  512. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -0
  513. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts +3 -0
  514. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -0
  515. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +2 -0
  516. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -0
  517. package/build-types/components/post-publish-panel/postpublish.d.ts +3 -0
  518. package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -0
  519. package/build-types/components/post-publish-panel/prepublish.d.ts +5 -0
  520. package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -0
  521. package/build-types/components/post-saved-state/index.d.ts +13 -0
  522. package/build-types/components/post-saved-state/index.d.ts.map +1 -0
  523. package/build-types/components/post-schedule/check.d.ts +12 -0
  524. package/build-types/components/post-schedule/check.d.ts.map +1 -0
  525. package/build-types/components/post-schedule/index.d.ts +17 -0
  526. package/build-types/components/post-schedule/index.d.ts.map +1 -0
  527. package/build-types/components/post-schedule/label.d.ts +25 -0
  528. package/build-types/components/post-schedule/label.d.ts.map +1 -0
  529. package/build-types/components/post-schedule/panel.d.ts +7 -0
  530. package/build-types/components/post-schedule/panel.d.ts.map +1 -0
  531. package/build-types/components/post-slug/check.d.ts +12 -0
  532. package/build-types/components/post-slug/check.d.ts.map +1 -0
  533. package/build-types/components/post-slug/index.d.ts +7 -0
  534. package/build-types/components/post-slug/index.d.ts.map +1 -0
  535. package/build-types/components/post-slug/panel.d.ts +3 -0
  536. package/build-types/components/post-slug/panel.d.ts.map +1 -0
  537. package/build-types/components/post-status/index.d.ts +6 -0
  538. package/build-types/components/post-status/index.d.ts.map +1 -0
  539. package/build-types/components/post-sticky/check.d.ts +12 -0
  540. package/build-types/components/post-sticky/check.d.ts.map +1 -0
  541. package/build-types/components/post-sticky/index.d.ts +7 -0
  542. package/build-types/components/post-sticky/index.d.ts.map +1 -0
  543. package/build-types/components/post-sticky/panel.d.ts +3 -0
  544. package/build-types/components/post-sticky/panel.d.ts.map +1 -0
  545. package/build-types/components/post-switch-to-draft-button/index.d.ts +7 -0
  546. package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -0
  547. package/build-types/components/post-sync-status/index.d.ts +7 -0
  548. package/build-types/components/post-sync-status/index.d.ts.map +1 -0
  549. package/build-types/components/post-taxonomies/check.d.ts +12 -0
  550. package/build-types/components/post-taxonomies/check.d.ts.map +1 -0
  551. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +66 -0
  552. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -0
  553. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +104 -0
  554. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -0
  555. package/build-types/components/post-taxonomies/index.d.ts +5 -0
  556. package/build-types/components/post-taxonomies/index.d.ts.map +1 -0
  557. package/build-types/components/post-taxonomies/most-used-terms.d.ts +5 -0
  558. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -0
  559. package/build-types/components/post-taxonomies/panel.d.ts +3 -0
  560. package/build-types/components/post-taxonomies/panel.d.ts.map +1 -0
  561. package/build-types/components/post-template/block-theme.d.ts +4 -0
  562. package/build-types/components/post-template/block-theme.d.ts.map +1 -0
  563. package/build-types/components/post-template/classic-theme.d.ts +3 -0
  564. package/build-types/components/post-template/classic-theme.d.ts.map +1 -0
  565. package/build-types/components/post-template/create-new-template-modal.d.ts +4 -0
  566. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -0
  567. package/build-types/components/post-template/create-new-template.d.ts +4 -0
  568. package/build-types/components/post-template/create-new-template.d.ts.map +1 -0
  569. package/build-types/components/post-template/hooks.d.ts +8 -0
  570. package/build-types/components/post-template/hooks.d.ts.map +1 -0
  571. package/build-types/components/post-template/panel.d.ts +7 -0
  572. package/build-types/components/post-template/panel.d.ts.map +1 -0
  573. package/build-types/components/post-template/reset-default-template.d.ts +4 -0
  574. package/build-types/components/post-template/reset-default-template.d.ts.map +1 -0
  575. package/build-types/components/post-template/swap-template-button.d.ts +4 -0
  576. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -0
  577. package/build-types/components/post-text-editor/index.d.ts +7 -0
  578. package/build-types/components/post-text-editor/index.d.ts.map +1 -0
  579. package/build-types/components/post-title/constants.d.ts +3 -0
  580. package/build-types/components/post-title/constants.d.ts.map +1 -0
  581. package/build-types/components/post-title/index.d.ts +3 -0
  582. package/build-types/components/post-title/index.d.ts.map +1 -0
  583. package/build-types/components/post-title/post-title-raw.d.ts +3 -0
  584. package/build-types/components/post-title/post-title-raw.d.ts.map +1 -0
  585. package/build-types/components/post-title/use-post-title-focus.d.ts +9 -0
  586. package/build-types/components/post-title/use-post-title-focus.d.ts.map +1 -0
  587. package/build-types/components/post-title/use-post-title.d.ts +7 -0
  588. package/build-types/components/post-title/use-post-title.d.ts.map +1 -0
  589. package/build-types/components/post-transform-panel/hooks.d.ts +2 -0
  590. package/build-types/components/post-transform-panel/hooks.d.ts.map +1 -0
  591. package/build-types/components/post-transform-panel/index.d.ts +2 -0
  592. package/build-types/components/post-transform-panel/index.d.ts.map +1 -0
  593. package/build-types/components/post-trash/check.d.ts +12 -0
  594. package/build-types/components/post-trash/check.d.ts.map +1 -0
  595. package/build-types/components/post-trash/index.d.ts +7 -0
  596. package/build-types/components/post-trash/index.d.ts.map +1 -0
  597. package/build-types/components/post-type-support-check/index.d.ts +18 -0
  598. package/build-types/components/post-type-support-check/index.d.ts.map +1 -0
  599. package/build-types/components/post-url/check.d.ts +12 -0
  600. package/build-types/components/post-url/check.d.ts.map +1 -0
  601. package/build-types/components/post-url/index.d.ts +14 -0
  602. package/build-types/components/post-url/index.d.ts.map +1 -0
  603. package/build-types/components/post-url/label.d.ts +13 -0
  604. package/build-types/components/post-url/label.d.ts.map +1 -0
  605. package/build-types/components/post-url/panel.d.ts +7 -0
  606. package/build-types/components/post-url/panel.d.ts.map +1 -0
  607. package/build-types/components/post-view-link/index.d.ts +2 -0
  608. package/build-types/components/post-view-link/index.d.ts.map +1 -0
  609. package/build-types/components/post-visibility/check.d.ts +13 -0
  610. package/build-types/components/post-visibility/check.d.ts.map +1 -0
  611. package/build-types/components/post-visibility/index.d.ts +11 -0
  612. package/build-types/components/post-visibility/index.d.ts.map +1 -0
  613. package/build-types/components/post-visibility/label.d.ts +13 -0
  614. package/build-types/components/post-visibility/label.d.ts.map +1 -0
  615. package/build-types/components/post-visibility/utils.d.ts +21 -0
  616. package/build-types/components/post-visibility/utils.d.ts.map +1 -0
  617. package/build-types/components/posts-per-page/index.d.ts +2 -0
  618. package/build-types/components/posts-per-page/index.d.ts.map +1 -0
  619. package/build-types/components/preferences-modal/enable-panel.d.ts +3 -0
  620. package/build-types/components/preferences-modal/enable-panel.d.ts.map +1 -0
  621. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts +14 -0
  622. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -0
  623. package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts +3 -0
  624. package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts.map +1 -0
  625. package/build-types/components/preferences-modal/index.d.ts +4 -0
  626. package/build-types/components/preferences-modal/index.d.ts.map +1 -0
  627. package/build-types/components/preview-dropdown/index.d.ts +5 -0
  628. package/build-types/components/preview-dropdown/index.d.ts.map +1 -0
  629. package/build-types/components/provider/disable-non-page-content-blocks.d.ts +6 -0
  630. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -0
  631. package/build-types/components/provider/index.d.ts +65 -0
  632. package/build-types/components/provider/index.d.ts.map +1 -0
  633. package/build-types/components/provider/navigation-block-editing-mode.d.ts +9 -0
  634. package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -0
  635. package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts +7 -0
  636. package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts.map +1 -0
  637. package/build-types/components/provider/use-block-editor-settings.d.ts +13 -0
  638. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -0
  639. package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts +9 -0
  640. package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts.map +1 -0
  641. package/build-types/components/provider/with-registry-provider.d.ts +3 -0
  642. package/build-types/components/provider/with-registry-provider.d.ts.map +1 -0
  643. package/build-types/components/resizable-editor/index.d.ts +8 -0
  644. package/build-types/components/resizable-editor/index.d.ts.map +1 -0
  645. package/build-types/components/resizable-editor/resize-handle.d.ts +5 -0
  646. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -0
  647. package/build-types/components/save-publish-panels/index.d.ts +11 -0
  648. package/build-types/components/save-publish-panels/index.d.ts.map +1 -0
  649. package/build-types/components/sidebar/constants.d.ts +5 -0
  650. package/build-types/components/sidebar/constants.d.ts.map +1 -0
  651. package/build-types/components/sidebar/header.d.ts +3 -0
  652. package/build-types/components/sidebar/header.d.ts.map +1 -0
  653. package/build-types/components/sidebar/index.d.ts +6 -0
  654. package/build-types/components/sidebar/index.d.ts.map +1 -0
  655. package/build-types/components/sidebar/post-summary.d.ts +4 -0
  656. package/build-types/components/sidebar/post-summary.d.ts.map +1 -0
  657. package/build-types/components/site-discussion/index.d.ts +2 -0
  658. package/build-types/components/site-discussion/index.d.ts.map +1 -0
  659. package/build-types/components/start-page-options/index.d.ts +2 -0
  660. package/build-types/components/start-page-options/index.d.ts.map +1 -0
  661. package/build-types/components/start-template-options/index.d.ts +2 -0
  662. package/build-types/components/start-template-options/index.d.ts.map +1 -0
  663. package/build-types/components/table-of-contents/index.d.ts +7 -0
  664. package/build-types/components/table-of-contents/index.d.ts.map +1 -0
  665. package/build-types/components/table-of-contents/panel.d.ts +6 -0
  666. package/build-types/components/table-of-contents/panel.d.ts.map +1 -0
  667. package/build-types/components/template-content-panel/index.d.ts +2 -0
  668. package/build-types/components/template-content-panel/index.d.ts.map +1 -0
  669. package/build-types/components/template-part-content-panel/index.d.ts +2 -0
  670. package/build-types/components/template-part-content-panel/index.d.ts.map +1 -0
  671. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts +5 -0
  672. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -0
  673. package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts +5 -0
  674. package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts.map +1 -0
  675. package/build-types/components/template-part-menu-items/index.d.ts +2 -0
  676. package/build-types/components/template-part-menu-items/index.d.ts.map +1 -0
  677. package/build-types/components/template-validation-notice/index.d.ts +2 -0
  678. package/build-types/components/template-validation-notice/index.d.ts.map +1 -0
  679. package/build-types/components/text-editor/index.d.ts +4 -0
  680. package/build-types/components/text-editor/index.d.ts.map +1 -0
  681. package/build-types/components/theme-support-check/index.d.ts +14 -0
  682. package/build-types/components/theme-support-check/index.d.ts.map +1 -0
  683. package/build-types/components/time-to-read/index.d.ts +7 -0
  684. package/build-types/components/time-to-read/index.d.ts.map +1 -0
  685. package/build-types/components/unsaved-changes-warning/index.d.ts +8 -0
  686. package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -0
  687. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +18 -0
  688. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -0
  689. package/build-types/components/visual-editor/index.d.ts +10 -0
  690. package/build-types/components/visual-editor/index.d.ts.map +1 -0
  691. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts +4 -0
  692. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -0
  693. package/build-types/components/word-count/index.d.ts +7 -0
  694. package/build-types/components/word-count/index.d.ts.map +1 -0
  695. package/build-types/dataviews/actions/delete-post.d.ts +5 -0
  696. package/build-types/dataviews/actions/delete-post.d.ts.map +1 -0
  697. package/build-types/dataviews/actions/export-pattern.d.ts +8 -0
  698. package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -0
  699. package/build-types/dataviews/actions/index.d.ts +2 -0
  700. package/build-types/dataviews/actions/index.d.ts.map +1 -0
  701. package/build-types/dataviews/actions/reset-post.d.ts +5 -0
  702. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -0
  703. package/build-types/dataviews/actions/utils.d.ts +11 -0
  704. package/build-types/dataviews/actions/utils.d.ts.map +1 -0
  705. package/build-types/dataviews/api.d.ts +27 -0
  706. package/build-types/dataviews/api.d.ts.map +1 -0
  707. package/build-types/dataviews/store/private-actions.d.ts +2 -2
  708. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  709. package/build-types/dataviews/store/private-selectors.d.ts +1 -5
  710. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
  711. package/build-types/dataviews/store/reducer.d.ts +5 -1
  712. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  713. package/build-types/dataviews/types.d.ts +34 -0
  714. package/build-types/dataviews/types.d.ts.map +1 -0
  715. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +10 -0
  716. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -0
  717. package/build-types/hooks/default-autocompleters.d.ts +2 -0
  718. package/build-types/hooks/default-autocompleters.d.ts.map +1 -0
  719. package/build-types/hooks/index.d.ts +2 -0
  720. package/build-types/hooks/index.d.ts.map +1 -0
  721. package/build-types/hooks/media-upload.d.ts +2 -0
  722. package/build-types/hooks/media-upload.d.ts.map +1 -0
  723. package/build-types/hooks/pattern-overrides.d.ts +2 -0
  724. package/build-types/hooks/pattern-overrides.d.ts.map +1 -0
  725. package/build-types/index.d.ts +6 -0
  726. package/build-types/index.d.ts.map +1 -0
  727. package/build-types/lock-unlock.d.ts +3 -0
  728. package/build-types/lock-unlock.d.ts.map +1 -0
  729. package/build-types/private-apis.d.ts +2 -0
  730. package/build-types/private-apis.d.ts.map +1 -0
  731. package/build-types/store/actions.d.ts +367 -0
  732. package/build-types/store/actions.d.ts.map +1 -0
  733. package/build-types/store/constants.d.ts +31 -0
  734. package/build-types/store/constants.d.ts.map +1 -0
  735. package/build-types/store/defaults.d.ts +21 -0
  736. package/build-types/store/defaults.d.ts.map +1 -0
  737. package/build-types/store/index.d.ts +17 -0
  738. package/build-types/store/index.d.ts.map +1 -0
  739. package/build-types/store/local-autosave.d.ts +4 -0
  740. package/build-types/store/local-autosave.d.ts.map +1 -0
  741. package/build-types/store/private-actions.d.ts +37 -0
  742. package/build-types/store/private-actions.d.ts.map +1 -0
  743. package/build-types/store/private-selectors.d.ts +24 -0
  744. package/build-types/store/private-selectors.d.ts.map +1 -0
  745. package/build-types/store/reducer.d.ts +228 -0
  746. package/build-types/store/reducer.d.ts.map +1 -0
  747. package/build-types/store/selectors.d.ts +853 -0
  748. package/build-types/store/selectors.d.ts.map +1 -0
  749. package/build-types/store/utils/is-template-revertable.d.ts +8 -0
  750. package/build-types/store/utils/is-template-revertable.d.ts.map +1 -0
  751. package/build-types/store/utils/notice-builder.d.ts +27 -0
  752. package/build-types/store/utils/notice-builder.d.ts.map +1 -0
  753. package/build-types/utils/get-template-part-icon.d.ts +9 -0
  754. package/build-types/utils/get-template-part-icon.d.ts.map +1 -0
  755. package/build-types/utils/index.d.ts +5 -0
  756. package/build-types/utils/index.d.ts.map +1 -0
  757. package/build-types/utils/media-upload/index.d.ts +21 -0
  758. package/build-types/utils/media-upload/index.d.ts.map +1 -0
  759. package/build-types/utils/terms.d.ts +12 -0
  760. package/build-types/utils/terms.d.ts.map +1 -0
  761. package/build-types/utils/url.d.ts +18 -0
  762. package/build-types/utils/url.d.ts.map +1 -0
  763. package/package.json +38 -36
  764. package/src/bindings/api.js +57 -0
  765. package/src/bindings/pattern-overrides.js +30 -20
  766. package/src/bindings/post-meta.js +24 -14
  767. package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
  768. package/src/components/blog-title/index.js +7 -2
  769. package/src/components/collapsible-block-toolbar/index.js +1 -3
  770. package/src/components/collapsible-block-toolbar/style.scss +0 -3
  771. package/src/components/document-bar/style.scss +1 -5
  772. package/src/components/document-tools/style.scss +4 -4
  773. package/src/components/editor-interface/index.js +17 -12
  774. package/src/components/editor-interface/style.scss +4 -0
  775. package/src/components/entities-saved-states/index.js +1 -1
  776. package/src/components/global-styles-provider/index.js +22 -11
  777. package/src/components/header/back-button.js +6 -6
  778. package/src/components/header/index.js +26 -25
  779. package/src/components/header/style.scss +64 -21
  780. package/src/components/inserter-sidebar/index.js +4 -24
  781. package/src/components/inserter-sidebar/style.scss +1 -6
  782. package/src/components/list-view-sidebar/index.js +34 -62
  783. package/src/components/list-view-sidebar/style.scss +0 -34
  784. package/src/components/page-attributes/order.js +3 -77
  785. package/src/components/page-attributes/panel.js +1 -7
  786. package/src/components/page-attributes/parent.js +6 -3
  787. package/src/components/post-actions/actions.js +227 -304
  788. package/src/components/post-actions/index.js +1 -1
  789. package/src/components/post-card-panel/index.js +8 -2
  790. package/src/components/post-comments/index.js +2 -2
  791. package/src/components/post-content-information/index.js +7 -1
  792. package/src/components/post-discussion/panel.js +5 -3
  793. package/src/components/post-excerpt/panel.js +3 -2
  794. package/src/components/post-featured-image/index.js +5 -1
  795. package/src/components/post-featured-image/style.scss +15 -0
  796. package/src/components/post-last-revision/index.js +1 -0
  797. package/src/components/post-panel-row/style.scss +1 -1
  798. package/src/components/post-preview-button/index.js +1 -1
  799. package/src/components/post-publish-button/index.js +4 -17
  800. package/src/components/post-publish-panel/index.js +1 -1
  801. package/src/components/post-publish-panel/maybe-category-panel.js +4 -1
  802. package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
  803. package/src/components/post-saved-state/index.js +11 -1
  804. package/src/components/post-schedule/index.js +5 -0
  805. package/src/components/post-status/index.js +19 -11
  806. package/src/components/post-taxonomies/README.md +1 -1
  807. package/src/components/post-taxonomies/flat-term-selector.js +19 -5
  808. package/src/components/post-taxonomies/index.js +8 -1
  809. package/src/components/post-template/block-theme.js +5 -1
  810. package/src/components/post-template/classic-theme.js +8 -3
  811. package/src/components/post-template/create-new-template.js +4 -1
  812. package/src/components/post-template/hooks.js +8 -2
  813. package/src/components/post-template/panel.js +10 -2
  814. package/src/components/post-title/index.js +5 -12
  815. package/src/components/post-trash/check.js +9 -5
  816. package/src/components/post-url/panel.js +7 -2
  817. package/src/components/posts-per-page/index.js +7 -2
  818. package/src/components/preview-dropdown/index.js +1 -1
  819. package/src/components/provider/index.native.js +3 -11
  820. package/src/components/provider/use-block-editor-settings.js +25 -11
  821. package/src/components/save-publish-panels/index.js +31 -24
  822. package/src/components/sidebar/index.js +2 -7
  823. package/src/components/sidebar/post-summary.js +0 -2
  824. package/src/components/site-discussion/index.js +9 -4
  825. package/src/components/template-content-panel/index.js +29 -4
  826. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  827. package/src/components/visual-editor/index.js +6 -3
  828. package/src/components/visual-editor/style.scss +1 -2
  829. package/src/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  830. package/src/dataviews/actions/delete-post.tsx +109 -0
  831. package/src/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.tsx} +19 -19
  832. package/src/dataviews/actions/index.ts +25 -0
  833. package/src/dataviews/actions/reset-post.tsx +144 -0
  834. package/src/dataviews/actions/utils.ts +54 -0
  835. package/src/dataviews/store/private-actions.ts +2 -2
  836. package/src/dataviews/store/private-selectors.ts +13 -6
  837. package/src/dataviews/store/reducer.ts +12 -5
  838. package/src/dataviews/types.ts +33 -0
  839. package/src/hooks/pattern-overrides.js +5 -2
  840. package/src/index.js +0 -1
  841. package/src/private-apis.js +8 -0
  842. package/src/private-apis.native.js +0 -2
  843. package/src/store/private-actions.js +1 -6
  844. package/src/store/private-selectors.js +0 -25
  845. package/src/store/test/actions.js +9 -3
  846. package/src/store/utils/is-template-revertable.js +8 -8
  847. package/src/style.scss +0 -1
  848. package/src/utils/media-upload/index.js +38 -3
  849. package/tsconfig.json +3 -2
  850. package/tsconfig.tsbuildinfo +1 -1
  851. package/build/bindings/index.js +0 -22
  852. package/build/bindings/index.js.map +0 -1
  853. package/build/components/post-actions/export-pattern-action.js.map +0 -1
  854. package/build/components/post-actions/export-pattern-action.native.js +0 -11
  855. package/build/components/post-actions/export-pattern-action.native.js.map +0 -1
  856. package/build/components/template-areas/index.js +0 -84
  857. package/build/components/template-areas/index.js.map +0 -1
  858. package/build/hooks/use-select-nearest-editable-block.js.map +0 -1
  859. package/build/store/utils/get-filtered-template-parts.js +0 -71
  860. package/build/store/utils/get-filtered-template-parts.js.map +0 -1
  861. package/build/utils/set-nested-value.js +0 -44
  862. package/build/utils/set-nested-value.js.map +0 -1
  863. package/build-module/bindings/index.js +0 -17
  864. package/build-module/bindings/index.js.map +0 -1
  865. package/build-module/components/post-actions/export-pattern-action.js.map +0 -1
  866. package/build-module/components/post-actions/export-pattern-action.native.js +0 -5
  867. package/build-module/components/post-actions/export-pattern-action.native.js.map +0 -1
  868. package/build-module/components/template-areas/index.js +0 -78
  869. package/build-module/components/template-areas/index.js.map +0 -1
  870. package/build-module/hooks/use-select-nearest-editable-block.js.map +0 -1
  871. package/build-module/store/utils/get-filtered-template-parts.js +0 -64
  872. package/build-module/store/utils/get-filtered-template-parts.js.map +0 -1
  873. package/build-module/utils/set-nested-value.js +0 -38
  874. package/build-module/utils/set-nested-value.js.map +0 -1
  875. package/src/bindings/index.js +0 -15
  876. package/src/components/post-actions/export-pattern-action.native.js +0 -4
  877. package/src/components/template-areas/index.js +0 -94
  878. package/src/components/template-areas/style.scss +0 -22
  879. package/src/store/utils/get-filtered-template-parts.js +0 -69
  880. package/src/store/utils/test/get-filtered-template-parts.js +0 -189
  881. package/src/utils/set-nested-value.js +0 -39
  882. /package/src/store/{constants.js → constants.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","__","useEntityRecord","store","coreStore","check","noticesStore","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","canCreateTemplate","_select$canUser","canUser","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","children","onClose","postId","postType","type","actions","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC1E,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAClD,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,SAASC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BAAoB;UAACiC,OAAO,EAAGa;QAAS,CAAE,CAAC,EAC1ClB,iBAAiB,iBAClBxB,IAAA,CAACF,iBAAiB;UAAC+B,OAAO,EAAGa;QAAS,CAAE,CACxC;MAAA,CACS,CAAC,eACZ1C,IAAA,CAACd,SAAS;QAAAuD,QAAA,eACTzC,IAAA,CAACb,QAAQ;UACRqD,IAAI,EAAG,CAAE9B,gBAAgB,GAAGlB,KAAK,GAAGuC,SAAW;UAC/CgB,UAAU,EAAG,CAAErC,gBAAkB;UACjCsC,IAAI,EAAC,kBAAkB;UACvBnB,OAAO,EAAGA,CAAA,KAAM;YACfN,gBAAgB,CACfb,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;UACF,CAAG;UAAA+B,QAAA,EAEDrD,EAAE,CAAE,eAAgB;QAAC,CACd;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","__","useEntityRecord","store","coreStore","check","noticesStore","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","canCreateTemplate","canUser","kind","name","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","children","onClose","postId","postType","type","actions","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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC1E,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAClD,OAAOC,kBAAkB,MAAM,wBAAwB;AACvD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,iBAAiB,MAAM,uBAAuB;AA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AACF,iBAAiB;UAACgC,OAAO,EAAGa;QAAS,CAAE,CACxC;MAAA,CACS,CAAC,eACZ3C,IAAA,CAACd,SAAS;QAAAwD,QAAA,eACT1C,IAAA,CAACb,QAAQ;UACRsD,IAAI,EAAG,CAAE/B,gBAAgB,GAAGlB,KAAK,GAAGwC,SAAW;UAC/CgB,UAAU,EAAG,CAAEtC,gBAAkB;UACjCuC,IAAI,EAAC,kBAAkB;UACvBnB,OAAO,EAAGA,CAAA,KAAM;YACfP,gBAAgB,CACfb,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;UACF,CAAG;UAAAgC,QAAA,EAEDtD,EAAE,CAAE,eAAgB;QAAC,CACd;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -35,7 +35,10 @@ function PostTemplateToggle({
35
35
  if (!supportsTemplateMode && availableTemplates[templateSlug]) {
36
36
  return availableTemplates[templateSlug];
37
37
  }
38
- const template = select(coreStore).canUser('create', 'templates') && select(editorStore).getCurrentTemplateId();
38
+ const template = select(coreStore).canUser('create', {
39
+ kind: 'postType',
40
+ name: 'wp_template'
41
+ }) && select(editorStore).getCurrentTemplateId();
39
42
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
40
43
  }, []);
41
44
  return /*#__PURE__*/_jsx(Button, {
@@ -76,7 +79,10 @@ function PostTemplateDropdownContent({
76
79
  getEntityRecords
77
80
  } = select(coreStore);
78
81
  const editorSettings = select(editorStore).getEditorSettings();
79
- const canCreateTemplates = canUser('create', 'templates');
82
+ const canCreateTemplates = canUser('create', {
83
+ kind: 'postType',
84
+ name: 'wp_template'
85
+ });
80
86
  const _currentTemplateId = select(editorStore).getCurrentTemplateId();
81
87
  return {
82
88
  availableTemplates: editorSettings.availableTemplates,
@@ -1 +1 @@
1
- {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","jsxs","_jsxs","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","getCurrentTemplateId","title","slug","__next40pxDefaultSize","variant","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","help","actions","icon","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","ClassicThemeControl","popoverProps","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) &&\n\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {JSX.Element} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', 'templates' );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\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),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\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} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {JSX.Element} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AAC/E,SAASC,S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,OAAO,EAAC,MAAM;QACdd,OAAO,EAAGA,CAAA,KAAM;UACf0B,wBAAwB,CAAE;YACzBgC,MAAM,EAAEjC,iBAAiB;YACzBkC,QAAQ,EAAE;UACX,CAAE,CAAC;UACH1C,OAAO,CAAC,CAAC;UACT8B,mBAAmB,CAClB1E,EAAE,CACD,uFACD,CAAC,EACD;YACCuF,IAAI,EAAE,UAAU;YAChBT,OAAO,EAAE,CACR;cACCT,KAAK,EAAErE,EAAE,CAAE,SAAU,CAAC;cACtB2B,OAAO,EAAEA,CAAA,KACRO,iBAAiB,CAAC,CAAC,CAACsD,gCAAgC,CAAC;YACvD,CAAC;UAEH,CACD,CAAC;QACF,CAAG;QAAA9C,QAAA,EAED1C,EAAE,CAAE,eAAgB;MAAC,CAChB;IAAC,CACP,CACH,EACC2E,iBAAiB,iBAClBxD,IAAA,CAACH,sBAAsB;MACtB4B,OAAO,EAAGA,CAAA,KAAMgC,oBAAoB,CAAE,KAAM;IAAG,CAC/C,CACD;EAAA,CACG,CAAC;AAER;AAEA,SAASa,mBAAmBA,CAAA,EAAG;EAC9B,oBACCtE,IAAA,CAACjB,QAAQ;IACRwF,YAAY,EAAGpE,aAAe;IAC9BqE,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAElE,MAAM;MAAEmE;IAAS,CAAC,kBACpC1E,IAAA,CAACM,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGkE;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAElD;IAAQ,CAAC,kBAC5BzB,IAAA,CAACwB,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe6C,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","jsxs","_jsxs","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","kind","name","getCurrentTemplateId","title","slug","__next40pxDefaultSize","variant","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","help","actions","icon","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","ClassicThemeControl","popoverProps","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {JSX.Element} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\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),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\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} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {JSX.Element} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAC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EJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe6C,mBAAmB","ignoreList":[]}
@@ -25,7 +25,10 @@ export default function CreateNewTemplate({
25
25
  canUser
26
26
  } = select(coreStore);
27
27
  return {
28
- canCreateTemplates: canUser('create', 'templates')
28
+ canCreateTemplates: canUser('create', {
29
+ kind: 'postType',
30
+ name: 'wp_template'
31
+ })
29
32
  };
30
33
  }, []);
31
34
  const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","onClick","canCreateTemplates","select","canUser","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate( { onClick } ) {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: canUser( 'create', 'templates' ),\n\t\t};\n\t}, [] );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,eAAe,SAASC,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACvC,OAAO;MACNY,kBAAkB,EAAEE,OAAO,CAAE,QAAQ,EAAE,WAAY;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGf,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAMgB,sBAAsB,GAAGd,0BAA0B,CAAC,CAAC;;EAE3D;EACA,IAAK,CAAES,kBAAkB,IAAI,CAAEK,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACCR,KAAA,CAAAF,SAAA;IAAAW,QAAA,gBACCb,IAAA,CAACT,QAAQ;MACRe,OAAO,EAAGA,CAAA,KAAM;QACfK,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAE,QAAA,EAEDrB,EAAE,CAAE,qBAAsB;IAAC,CACpB,CAAC,EAETkB,iBAAiB,iBAClBV,IAAA,CAACH,sBAAsB;MACtBiB,OAAO,EAAGA,CAAA,KAAM;QACfH,oBAAoB,CAAE,KAAM,CAAC;QAC7BL,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","onClick","canCreateTemplates","select","canUser","kind","name","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate( { onClick } ) {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: 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\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,eAAe,SAASC,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACvC,OAAO;MACNY,kBAAkB,EAAEE,OAAO,CAAE,QAAQ,EAAE;QACtCC,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;MACP,CAAE;IACH,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGjB,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAMkB,sBAAsB,GAAGhB,0BAA0B,CAAC,CAAC;;EAE3D;EACA,IAAK,CAAES,kBAAkB,IAAI,CAAEO,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACCV,KAAA,CAAAF,SAAA;IAAAa,QAAA,gBACCf,IAAA,CAACT,QAAQ;MACRe,OAAO,EAAGA,CAAA,KAAM;QACfO,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAE,QAAA,EAEDvB,EAAE,CAAE,qBAAsB;IAAC,CACpB,CAAC,EAEToB,iBAAiB,iBAClBZ,IAAA,CAACH,sBAAsB;MACtBmB,OAAO,EAAGA,CAAA,KAAM;QACfH,oBAAoB,CAAE,KAAM,CAAC;QAC7BP,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -28,10 +28,14 @@ export function useAllowSwitchingTemplates() {
28
28
  } = useEditedPostContext();
29
29
  return useSelect(select => {
30
30
  const {
31
+ canUser,
31
32
  getEntityRecord,
32
33
  getEntityRecords
33
34
  } = select(coreStore);
34
- const siteSettings = getEntityRecord('root', 'site');
35
+ const siteSettings = canUser('read', {
36
+ kind: 'root',
37
+ name: 'site'
38
+ }) ? getEntityRecord('root', 'site') : undefined;
35
39
  const templates = getEntityRecords('postType', 'wp_template', {
36
40
  per_page: -1
37
41
  });
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useMemo","store","coreStore","editorStore","useEditedPostContext","select","getCurrentPostId","getCurrentPostType","postId","postType","useAllowSwitchingTemplates","getEntityRecord","getEntityRecords","siteSettings","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","filter","template","is_custom","content","raw","entityTemplate","post","getEditedEntityRecord","find"],"sources":["@wordpress/editor/src/components/post-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' &&\n\t\t\t\t+postId === siteSettings?.page_on_front &&\n\t\t\t\ttemplates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! isFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t\tpost_type: postType,\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\ttemplate.is_custom &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEF,WAAY,CAAC;IACtE,OAAO;MACNK,MAAM,EAAEF,gBAAgB,CAAC,CAAC;MAC1BG,QAAQ,EAAEF,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;AACA,OAAO,SAASG,0BAA0BA,CAAA,EAAG;EAC5C,MAAM;IAAED,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,OAAOL,SAAS,CACbM,MAAM,IAAM;IACb,MAAM;MAAEM,eAAe;MAAEC;IAAiB,CAAC,GAAGP,MAAM,CAAEH,SAAU,CAAC;IACjE,MAAMW,YAAY,GAAGF,eAAe,CAAE,MAAM,EAA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AAO,SAASD,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEjB,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,MAAMU,SAAS,GAAGQ,YAAY,CAAEb,QAAS,CAAC;EAC1C,MAAMwB,cAAc,GAAGlC,SAAS,CAC7BM,MAAM,IAAM;IACb,MAAM6B,IAAI,GAAG7B,MAAM,CAAEH,SAAU,CAAC,CAACiC,qBAAqB,CACrD,UAAU,EACV1B,QAAQ,EACRD,MACD,CAAC;IACD,OAAO0B,IAAI,EAAEL,QAAQ;EACtB,CAAC,EACD,CAAEpB,QAAQ,EAAED,MAAM,CACnB,CAAC;EAED,IAAK,CAAEyB,cAAc,EAAG;IACvB;EACD;EACA;EACA;EACA;EACA,OAAOnB,SAAS,EAAEsB,IAAI,CAAIP,QAAQ,IAAMA,QAAQ,CAACR,IAAI,KAAKY,cAAe,CAAC,EACvEZ,IAAI;AACR","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useMemo","store","coreStore","editorStore","useEditedPostContext","select","getCurrentPostId","getCurrentPostType","postId","postType","useAllowSwitchingTemplates","canUser","getEntityRecord","getEntityRecords","siteSettings","kind","name","undefined","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","filter","template","is_custom","content","raw","entityTemplate","post","getEditedEntityRecord","find"],"sources":["@wordpress/editor/src/components/post-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' &&\n\t\t\t\t+postId === siteSettings?.page_on_front &&\n\t\t\t\ttemplates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! isFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t\tpost_type: postType,\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\ttemplate.is_custom &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEF,WAAY,CAAC;IACtE,OAAO;MACNK,MAAM,EAAEF,gBAAgB,CAAC,CAAC;MAC1BG,QAAQ,EAAEF,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;AACA,OAAO,SAASG,0BAA0BA,CAAA,EAAG;EAC5C,MAAM;IAAED,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,OAAOL,SAAS,CACbM,MAAM,IAAM;IACb,MAAM;MAAEM,OAAO;MAAEC,eAAe;MAAEC;IAAiB,CAAC,GACnDR,MAAM,CAAEH,SAAU,CAAC;IACpB,MAAMY,YAAY,GAAGH,OAAO,CAAE,MAAM,EAAE;MACrCI,IAAI,EAAE,MAAM;MACZC,IAA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,EACF,CAAElB,SAAS,EAAEW,mBAAmB,EAAEE,sBAAsB,CACzD,CAAC;AACF;AAEA,OAAO,SAASD,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAErB,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,MAAMc,SAAS,GAAGQ,YAAY,CAAEjB,QAAS,CAAC;EAC1C,MAAM4B,cAAc,GAAGtC,SAAS,CAC7BM,MAAM,IAAM;IACb,MAAMiC,IAAI,GAAGjC,MAAM,CAAEH,SAAU,CAAC,CAACqC,qBAAqB,CACrD,UAAU,EACV9B,QAAQ,EACRD,MACD,CAAC;IACD,OAAO8B,IAAI,EAAEL,QAAQ;EACtB,CAAC,EACD,CAAExB,QAAQ,EAAED,MAAM,CACnB,CAAC;EAED,IAAK,CAAE6B,cAAc,EAAG;IACvB;EACD;EACA;EACA;EACA;EACA,OAAOnB,SAAS,EAAEsB,IAAI,CAAIP,QAAQ,IAAMA,QAAQ,CAACR,IAAI,KAAKY,cAAe,CAAC,EACvEZ,IAAI;AACR","ignoreList":[]}
@@ -48,12 +48,18 @@ export default function PostTemplatePanel() {
48
48
  if (!settings.supportsTemplateMode) {
49
49
  return false;
50
50
  }
51
- const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
51
+ const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', {
52
+ kind: 'postType',
53
+ name: 'wp_template'
54
+ })) !== null && _select$canUser !== void 0 ? _select$canUser : false;
52
55
  return canCreateTemplates;
53
56
  }, []);
54
57
  const canViewTemplates = useSelect(select => {
55
58
  var _select$canUser2;
56
- return (_select$canUser2 = select(coreStore).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
59
+ return (_select$canUser2 = select(coreStore).canUser('read', {
60
+ kind: 'postType',
61
+ name: 'wp_template'
62
+ })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
57
63
  }, []);
58
64
  if ((!isBlockTheme || !canViewTemplates) && isVisible) {
59
65
  return /*#__PURE__*/_jsx(PostPanelRow, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","canViewTemplates","_select$canUser2","label","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {JSX.Element|null} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn select( coreStore ).canUser( 'read', 'templates' ) ?? false;\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<BlockThemeControl id={ templateId } />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,OAAOC,mBAAmB,MAAM,iBAAiB;AACjD,OAAOC,iBAAiB,MAAM,eAAe;AAC7C,OAAOC,YAAY,MAAM,mBAAmB;;AAE5C;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAKA,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,UAAU;IAAEC;EAAa,CAAC,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IAC7D,MAAM;MAAEC,oBAAoB;MAAEC;IAAkB,CAAC,GAChDF,MAAM,CAAET,WAAY,CAAC;IACtB,OAAO;MACNO,UAAU,EAAEG,oBAAoB,CAAC,CAAC;MAClCF,YAAY,EAAEG,iBAA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AAS,EAAG;IAC5D,oBACCR,IAAA,CAACF,YAAY;MAAC4B,KAAK,EAAGlC,EAAE,CAAE,UAAW,CAAG;MAAAmC,QAAA,eACvC3B,IAAA,CAACJ,mBAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAKO,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACCF,IAAA,CAACF,YAAY;MAAC4B,KAAK,EAAGlC,EAAE,CAAE,UAAW,CAAG;MAAAmC,QAAA,eACvC3B,IAAA,CAACH,iBAAiB;QAAC+B,EAAE,EAAG1B;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","label","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {JSX.Element|null} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<BlockThemeControl id={ templateId } />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,W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AAU,CAAC,CAAC6B,OAAO,CAAE,QAAQ,EAAE;MACtCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAhB,eAAA,cAAAA,eAAA,GAAI,KAAK;IACb,OAAOa,kBAAkB;EAC1B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMI,gBAAgB,GAAGnC,SAAS,CAAIa,MAAM,IAAM;IAAA,IAAAuB,gBAAA;IACjD,QAAAA,gBAAA,GACCvB,MAAM,CAAEV,SAAU,CAAC,CAAC6B,OAAO,CAAE,MAAM,EAAE;MACpCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EAEd,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAExB,YAAY,IAAI,CAAEuB,gBAAgB,KAAMlB,SAAS,EAAG;IAC5D,oBACCR,IAAA,CAACF,YAAY;MAAC8B,KAAK,EAAGpC,EAAE,CAAE,UAAW,CAAG;MAAAqC,QAAA,eACvC7B,IAAA,CAACJ,mBAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAKO,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACCF,IAAA,CAACF,YAAY;MAAC8B,KAAK,EAAGpC,EAAE,CAAE,UAAW,CAAG;MAAAqC,QAAA,eACvC7B,IAAA,CAACH,iBAAiB;QAACiC,EAAE,EAAG5B;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -79,22 +79,14 @@ function PostTitle(_, forwardedRef) {
79
79
  const clipboardData = event.clipboardData;
80
80
  let plainText = '';
81
81
  let html = '';
82
-
83
- // IE11 only supports `Text` as an argument for `getData` and will
84
- // otherwise throw an invalid argument error, so we try the standard
85
- // arguments first, then fallback to `Text` if they fail.
86
82
  try {
87
83
  plainText = clipboardData.getData('text/plain');
88
84
  html = clipboardData.getData('text/html');
89
- } catch (error1) {
90
- try {
91
- html = clipboardData.getData('Text');
92
- } catch (error2) {
93
- // Some browsers like UC Browser paste plain text by default and
94
- // don't support clipboardData at all, so allow default
95
- // behaviour.
96
- return;
97
- }
85
+ } catch (error) {
86
+ // Some browsers like UC Browser paste plain text by default and
87
+ // don't support clipboardData at all, so allow default
88
+ // behaviour.
89
+ return;
98
90
  }
99
91
 
100
92
  // Allows us to ask for this information when we get a report.
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","forwardRef","useState","decodeEntities","useSelect","useDispatch","store","blockEditorStore","ENTER","pasteHandler","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","DEFAULT_CLASSNAMES","REGEXP_NEWLINES","usePostTitleFocus","usePostTitle","PostTypeSupportCheck","jsx","_jsx","PostTitle","_","forwardedRef","placeholder","select","getSettings","titlePlaceholder","isSelected","setIsSelected","ref","focusRef","title","setTitle","onUpdate","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","onChange","value","replace","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","contentNoHTML","attributes","slice","newValue","start","end","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","supportKeys","children","contentEditable","role","onFocus","onBlur","onKeyPress"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ENTER } from '@wordpress/keycodes';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst { placeholder } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder } = getSettings();\n\n\t\treturn {\n\t\t\tplaceholder: titlePlaceholder,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tconst { clearSelectedBlock, insertBlocks, insertDefaultBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t\t// is undesirable.\n\t\t\t\tconst contentNoHTML = stripHTML(\n\t\t\t\t\tfirstBlock.attributes.content\n\t\t\t\t);\n\t\t\t\tonUpdate( contentNoHTML );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\n\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t// is undesirable.\n\t\t\tconst contentNoHTML = stripHTML( content );\n\n\t\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: false,\n\t} );\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = clsx( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t} );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, focusRef ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t);\n}\n\n/**\n * Renders the `PostTitle` component.\n *\n * @param {Object} _ Unused parameter.\n * @param {Element} forwardedRef Forwarded ref for the component.\n *\n * @return {Component} The rendered PostTitle component.\n */\nexport default forwardRef( PostTitle );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SACCC,qBAAqB,IAAIC,WAAW,EACpCC,MAAM,EACNC,YAAY,EACZC,MAAM,QACA,sBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,aAAa;AACjE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,oBAAoB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9D,SAASC,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC;EAAY,CAAC,GAAGxB,SAAS,CAAIyB,MAAM,IAAM;IAChD,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEtB,gBAAiB,CAAC;IAClD,MAAM;MAAEwB;IAAiB,CAAC,GAAGD,WAAW,CAAC,CAAC;IAE1C,OAAO;MACNF,WAAW,EAAEG;IACd,CAAC;EACF,CAAC,EAAE,EAAG,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AC;EAEH;IAAA;IACC;IACAR,IAAA,CAACF,oBAAoB;MAACkE,WAAW,EAAC,OAAO;MAAAC,QAAA,eACxCjE,IAAA;QACCU,GAAG,EAAGnB,YAAY,CAAE,CAAEgE,WAAW,EAAE5C,QAAQ,CAAG,CAAG;QACjDuD,eAAe;QACfH,SAAS,EAAGA,SAAW;QACvB,cAAaT,kBAAoB;QACjCa,IAAI,EAAC,SAAS;QACd,kBAAe,MAAM;QACrBC,OAAO,EAAG3C,QAAU;QACpB4C,MAAM,EAAG3C,UAAY;QACrBG,SAAS,EAAGA,SAAW;QACvByC,UAAU,EAAG5C,UAAY;QACzBO,OAAO,EAAGA;MAAS,CACnB;IAAC,CACmB;IACtB;EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAexD,UAAU,CAAEwB,SAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","forwardRef","useState","decodeEntities","useSelect","useDispatch","store","blockEditorStore","ENTER","pasteHandler","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","DEFAULT_CLASSNAMES","REGEXP_NEWLINES","usePostTitleFocus","usePostTitle","PostTypeSupportCheck","jsx","_jsx","PostTitle","_","forwardedRef","placeholder","select","getSettings","titlePlaceholder","isSelected","setIsSelected","ref","focusRef","title","setTitle","onUpdate","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","onChange","value","replace","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error","window","console","log","content","HTML","length","firstBlock","name","contentNoHTML","attributes","slice","newValue","start","end","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","supportKeys","children","contentEditable","role","onFocus","onBlur","onKeyPress"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ENTER } from '@wordpress/keycodes';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst { placeholder } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder } = getSettings();\n\n\t\treturn {\n\t\t\tplaceholder: titlePlaceholder,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tconst { clearSelectedBlock, insertBlocks, insertDefaultBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t\t// is undesirable.\n\t\t\t\tconst contentNoHTML = stripHTML(\n\t\t\t\t\tfirstBlock.attributes.content\n\t\t\t\t);\n\t\t\t\tonUpdate( contentNoHTML );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\n\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t// is undesirable.\n\t\t\tconst contentNoHTML = stripHTML( content );\n\n\t\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: false,\n\t} );\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = clsx( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t} );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, focusRef ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t);\n}\n\n/**\n * Renders the `PostTitle` component.\n *\n * @param {Object} _ Unused parameter.\n * @param {Element} forwardedRef Forwarded ref for the component.\n *\n * @return {Component} The rendered PostTitle component.\n */\nexport default forwardRef( PostTitle );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SACCC,qBAAqB,IAAIC,WAAW,EACpCC,MAAM,EACNC,YAAY,EACZC,MAAM,QACA,sBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,aAAa;AACjE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,oBAAoB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9D,SAASC,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC;EAAY,CAAC,GAAGxB,SAAS,CAAIyB,MAAM,IAAM;IAChD,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEtB,gBAAiB,CAAC;IAClD,MAAM;MAAEwB;IAAiB,CAAC,GAAGD,WAAW,CAAC,CAAC;IAE1C,OAAO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O;MAAAC,QAAA,eACxChE,IAAA;QACCU,GAAG,EAAGnB,YAAY,CAAE,CAAE+D,WAAW,EAAE3C,QAAQ,CAAG,CAAG;QACjDsD,eAAe;QACfH,SAAS,EAAGA,SAAW;QACvB,cAAaT,kBAAoB;QACjCa,IAAI,EAAC,SAAS;QACd,kBAAe,MAAM;QACrBC,OAAO,EAAG1C,QAAU;QACpB2C,MAAM,EAAG1C,UAAY;QACrBG,SAAS,EAAGA,SAAW;QACvBwC,UAAU,EAAG3C,UAAY;QACzBO,OAAO,EAAGA;MAAS,CACnB;IAAC,CACmB;IACtB;EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAexD,UAAU,CAAEwB,SAAU,CAAC","ignoreList":[]}
@@ -29,14 +29,16 @@ export default function PostTrashCheck({
29
29
  getCurrentPostType
30
30
  } = select(editorStore);
31
31
  const {
32
- getPostType,
33
32
  canUser
34
33
  } = select(coreStore);
35
- const postType = getPostType(getCurrentPostType());
34
+ const postType = getCurrentPostType();
36
35
  const postId = getCurrentPostId();
37
36
  const isNew = isEditedPostNew();
38
- const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
39
- const canUserDelete = postId && resource ? canUser('delete', resource, postId) : false;
37
+ const canUserDelete = !!postId ? canUser('delete', {
38
+ kind: 'postType',
39
+ name: postType,
40
+ id: postId
41
+ }) : false;
40
42
  return {
41
43
  canTrashPost: (!isNew || postId) && canUserDelete
42
44
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","editorStore","PostTrashCheck","children","canTrashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","getPostType","canUser","postType","postId","isNew","resource","rest_base","canUserDelete"],"sources":["@wordpress/editor/src/components/post-trash/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post can trashed.\n *\n * @param {Object} props - The component props.\n * @param {Element} props.children - The child components to render.\n *\n * @return {Component|null} The rendered child components or null if the post can not trashed.\n */\nexport default function PostTrashCheck( { children } ) {\n\tconst { canTrashPost } = useSelect( ( select ) => {\n\t\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getPostType, canUser } = select( coreStore );\n\t\tconst postType = getPostType( getCurrentPostType() );\n\t\tconst postId = getCurrentPostId();\n\t\tconst isNew = isEditedPostNew();\n\t\tconst resource = postType?.rest_base || ''; // eslint-disable-line camelcase\n\t\tconst canUserDelete =\n\t\t\tpostId && resource ? canUser( 'delete', resource, postId ) : false;\n\n\t\treturn {\n\t\t\tcanTrashPost: ( ! isNew || postId ) && canUserDelete,\n\t\t};\n\t}, [] );\n\n\tif ( ! canTrashPost ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEJ,WAAY,CAAC;IACtB,MAAM;MAAEQ,WAAW;MAAEC;IAAQ,CAAC,GAAGL,MAAM,CAAEL,SAAU,CAAC;IACpD,MAAMW,QAAQ,GAAGF,WAAW,CAAED,kBAAkB,CAAC,CAAE,CAAC;IACpD,MAAMI,MAAM,GAAGL,gBAAgB,CAAC,CAAC;IACjC,MAAMM,KAAK,GAAGP,eAAe,CAAC,CAAC;IAC/B,MAAMQ,QAAQ,GAAGH,QAAQ,EAAEI,SAAS,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAMC,aAAa,GAClBJ,MAAM,IAAIE,QAAQ,GAAGJ,OAAO,CAAE,QAAQ,EAAEI,QAAQ,EAAEF,MAAO,CAAC,GAAG,KAAK;IAEnE,OAAO;MACNR,YAAY,EAAE,CAAE,CAAES,KAAK,IAAID,MAAM,KAAMI;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","editorStore","PostTrashCheck","children","canTrashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","canUser","postType","postId","isNew","canUserDelete","kind","name","id"],"sources":["@wordpress/editor/src/components/post-trash/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post can trashed.\n *\n * @param {Object} props - The component props.\n * @param {Element} props.children - The child components to render.\n *\n * @return {Component|null} The rendered child components or null if the post can not trashed.\n */\nexport default function PostTrashCheck( { children } ) {\n\tconst { canTrashPost } = useSelect( ( select ) => {\n\t\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst postType = getCurrentPostType();\n\t\tconst postId = getCurrentPostId();\n\t\tconst isNew = isEditedPostNew();\n\t\tconst canUserDelete = !! postId\n\t\t\t? canUser( 'delete', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t\tid: postId,\n\t\t\t } )\n\t\t\t: false;\n\n\t\treturn {\n\t\t\tcanTrashPost: ( ! isNew || postId ) && canUserDelete,\n\t\t};\n\t}, [] );\n\n\tif ( ! canTrashPost ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEJ,WAAY,CAAC;IACtB,MAAM;MAAEQ;IAAQ,CAAC,GAAGJ,MAAM,CAAEL,SAAU,CAAC;IACvC,MAAMU,QAAQ,GAAGF,kBAAkB,CAAC,CAAC;IACrC,MAAMG,MAAM,GAAGJ,gBAAgB,CAAC,CAAC;IACjC,MAAMK,KAAK,GAAGN,eAAe,CAAC,CAAC;IAC/B,MAAMO,aAAa,GAAG,CAAC,CAAEF,MAAM,GAC5BF,OAAO,CAAE,QAAQ,EAAE;MACnBK,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAEL,QAAQ;MACdM,EAAE,EAAEL;IACJ,CAAE,CAAC,GACH,KAAK;IAER,OAAO;MACNP,YAAY,EAAE,CAAE,CAAEQ,KAAK,IAAID,MAAM,KAAME;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAET,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
@@ -76,9 +76,13 @@ function PostURLToggle({
76
76
  getCurrentPost
77
77
  } = select(editorStore);
78
78
  const {
79
- getEditedEntityRecord
79
+ getEditedEntityRecord,
80
+ canUser
80
81
  } = select(coreStore);
81
- const siteSettings = getEditedEntityRecord('root', 'site');
82
+ const siteSettings = canUser('read', {
83
+ kind: 'root',
84
+ name: 'site'
85
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
82
86
  const _id = getCurrentPostId();
83
87
  return {
84
88
  slug: select(editorStore).getEditedPostSlug(),
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","useSelect","Dropdown","Button","__","sprintf","safeDecodeURIComponent","store","coreStore","PostURLCheck","PostURL","PostPanelRow","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","select","getCurrentPostId","getCurrentPost","getEditedEntityRecord","siteSettings","_id","getEditedPostSlug","page_on_front","link","decodedSlug","size","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ isFrontPage ? postLink : <>/{ decodedS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,EAAGA,OAAS;IAAAV,QAAA,EAEjBc,WAAW,GAAGC,QAAQ,gBAAGxB,KAAA,CAAAF,SAAA;MAAAW,QAAA,GAAE,GAAC,EAAEyB,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","useSelect","Dropdown","Button","__","sprintf","safeDecodeURIComponent","store","coreStore","PostURLCheck","PostURL","PostPanelRow","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","select","getCurrentPostId","getCurrentPost","getEditedEntityRecord","canUser","siteSettings","kind","name","undefined","_id","getEditedPostSlug","page_on_front","link","decodedSlug","size","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' 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,MAAM;IACNsD,IAAI,EAAC,SAAS;IACd3B,SAAS,EAAC,+BAA+B;IACzC4B,OAAO,EAAC,UAAU;IAClB,iBAAgBxB;IAChB;IAAA;IACA,cAAa7B,OAAO,CAAED,EAAE,CAAE,iBAAkB,CAAC,EAAEoD,WAAY,CAAG;IAC9DnB,OAAO,EAAGA,OAAS;IAAAV,QAAA,EAEjBc,WAAW,GAAGC,QAAQ,gBAAGxB,KAAA,CAAAF,SAAA;MAAAW,QAAA,GAAE,GAAC,EAAE6B,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
@@ -31,9 +31,13 @@ export default function PostsPerPage() {
31
31
  getCurrentPostType
32
32
  } = select(editorStore);
33
33
  const {
34
- getEditedEntityRecord
34
+ getEditedEntityRecord,
35
+ canUser
35
36
  } = select(coreStore);
36
- const siteSettings = getEditedEntityRecord('root', 'site');
37
+ const siteSettings = canUser('read', {
38
+ kind: 'root',
39
+ name: 'site'
40
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
37
41
  return {
38
42
  isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,
39
43
  postSlug: getEditedPostAttribute('slug'),
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","useDispatch","store","coreStore","Button","Dropdown","__experimentalNumberControl","NumberControl","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","TEMPLATE_POST_TYPE","editorStore","PostPanelRow","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostsPerPage","editEntityRecord","postsPerPage","isTemplate","postSlug","select","getEditedPostAttribute","getCurrentPostType","getEditedEntityRecord","siteSettings","posts_per_page","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","includes","setPostsPerPage","newValue","undefined","label","ref","children","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","onClick","renderContent","onClose","title","placeholder","value","spinControls","step","min","onChange","help","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/posts-per-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tButton,\n\tDropdown,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostsPerPage() {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postsPerPage, isTemplate, postSlug } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tisTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostsPerPage: siteSettings?.posts_per_page || 1,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isTemplate || ! [ 'home', 'index' ].includes( postSlug ) ) {\n\t\treturn null;\n\t}\n\tconst setPostsPerPage = ( newValue ) => {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tposts_per_page: newValue,\n\t\t} );\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Posts per page' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tcontentClassName=\"editor-posts-per-page-dropdown__content\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\taria-label={ __( 'Change posts per page' ) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ postsPerPage }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tplaceholder={ 0 }\n\t\t\t\t\t\t\tvalue={ postsPerPage }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tspinControls=\"custom\"\n\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tonChange={ setPostsPerPage }\n\t\t\t\t\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\thideLabelFromVision\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</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EA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C,KAAK,EAAGnC,YAAc;UACtB4B,IAAI,EAAC,kBAAkB;UACvBQ,YAAY,EAAC,QAAQ;UACrBC,IAAI,EAAC,GAAG;UACRC,GAAG,EAAC,GAAG;UACPC,QAAQ,EAAGtB,eAAiB;UAC5BG,KAAK,EAAG5C,EAAE,CAAE,gBAAiB,CAAG;UAChCgE,IAAI,EAAGhE,EAAE,CACR,oIACD,CAAG;UACHiE,mBAAmB;QAAA,CACnB,CAAC;MAAA,CACD;IACA,CACH;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["__","useSelect","useDispatch","store","coreStore","Button","Dropdown","__experimentalNumberControl","NumberControl","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","TEMPLATE_POST_TYPE","editorStore","PostPanelRow","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostsPerPage","editEntityRecord","postsPerPage","isTemplate","postSlug","select","getEditedPostAttribute","getCurrentPostType","getEditedEntityRecord","canUser","siteSettings","kind","name","undefined","posts_per_page","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","includes","setPostsPerPage","newValue","label","ref","children","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","onClick","renderContent","onClose","title","placeholder","value","spinControls","step","min","onChange","help","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/posts-per-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tButton,\n\tDropdown,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostsPerPage() {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postsPerPage, isTemplate, postSlug } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tisTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostsPerPage: siteSettings?.posts_per_page || 1,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isTemplate || ! [ 'home', 'index' ].includes( postSlug ) ) {\n\t\treturn null;\n\t}\n\tconst setPostsPerPage = ( newValue ) => {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tposts_per_page: newValue,\n\t\t} );\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Posts per page' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tcontentClassName=\"editor-posts-per-page-dropdown__content\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\taria-label={ __( 'Change posts per page' ) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ postsPerPage }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tplaceholder={ 0 }\n\t\t\t\t\t\t\tvalue={ postsPerPage }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tspinControls=\"custom\"\n\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tonChange={ setPostsPerPage }\n\t\t\t\t\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\thideLabelFromVision\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</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,MAAM,EACNC,QAAQ,EACRC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;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G/C,EAAE,CAAE,gBAAiB,CAAG;UAChCmE,IAAI,EAAGnE,EAAE,CACR,oIACD,CAAG;UACHoE,mBAAmB;QAAA,CACnB,CAAC;MAAA,CACD;IACA,CACH;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
@@ -64,7 +64,7 @@ export default function PreviewDropdown({
64
64
  size: 'compact',
65
65
  showTooltip: !showIconLabels,
66
66
  disabled,
67
- __experimentalIsFocusable: disabled
67
+ accessibleWhenDisabled: disabled
68
68
  };
69
69
  const menuProps = {
70
70
  'aria-label': __('View options')