@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":["_element","require","_data","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","_jsxRuntime","identity","x","PostTaxonomies","taxonomyWrapper","postType","taxonomies","useSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","visibleTaxonomies","filter","taxonomy","types","includes","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","jsx","Fragment","children","slug","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( { taxonomyWrapper = identity } ) {\n\tconst { postType, taxonomies } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t}, [] );\n\tconst visibleTaxonomies = ( taxonomies ?? [] ).filter(\n\t\t( taxonomy ) =>\n\t\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t\ttaxonomy.types.includes( postType ) && taxonomy.visibility?.show_ui\n\t);\n\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\n/**\n * Renders the taxonomies associated with a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component.\n *\n * @return {Array} An array of JSX elements representing the visible taxonomies.\n */\nexport default PostTaxonomies;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAZnD;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMQ,QAAQ,GAAKC,CAAC,IAAMA,CAAC;AAEpB,SAASC,cAAcA,CAAE;EAAEC,eAAe,GAAGH;AAAS,CAAC,EAAG;EAChE,MAAM;IAAEI,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;MACpDJ,UAAU,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,aAAa,CAAE;QAAEC,QAAQ,EAAE,CAAC;MAAE,CAAE;IACjE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,iBAAiB,GAAG,CAAER,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE,EAAGS,MAAM,CAClDC,QAAQ;EACT;EACA;EACAA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEb,QAAS,CAAC,IAAIW,QAAQ,CAACG,UAAU,EAAEC,OAC9D,CAAC;EAED,OAAON,iBAAiB,CAACO,GAAG,CAAIL,QAAQ,IAAM;IAC7C,MAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAY,GAC5CC,iCAAwB,GACxBC,yBAAgB;IACnB,oBACC,IAAAzB,WAAA,CAAA0B,GAAA,EAAClC,QAAA,CAAAmC,QAAQ;MAAAC,QAAA,EACNxB,eAAe,eAChB,IAAAJ,WAAA,CAAA0B,GAAA,EAACJ,iBAAiB;QAACO,IAAI,EAAGb,QAAQ,CAACa;MAAM,CAAE,CAAC,EAC5Cb,QACD;IAAC,GAJe,YAAYA,QAAQ,CAACa,IAAM,EAKlC,CAAC;EAEb,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe7B,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","_jsxRuntime","identity","x","PostTaxonomies","taxonomyWrapper","postType","taxonomies","useSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","visibleTaxonomies","filter","taxonomy","types","includes","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","taxonomyComponentProps","slug","__nextHasNoMarginBottom","jsx","Fragment","children","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( { taxonomyWrapper = identity } ) {\n\tconst { postType, taxonomies } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t}, [] );\n\tconst visibleTaxonomies = ( taxonomies ?? [] ).filter(\n\t\t( taxonomy ) =>\n\t\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t\ttaxonomy.types.includes( postType ) && taxonomy.visibility?.show_ui\n\t);\n\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\tconst taxonomyComponentProps = {\n\t\t\tslug: taxonomy.slug,\n\t\t\t...( taxonomy.hierarchical\n\t\t\t\t? {}\n\t\t\t\t: { __nextHasNoMarginBottom: true } ),\n\t\t};\n\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent { ...taxonomyComponentProps } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\n/**\n * Renders the taxonomies associated with a post.\n *\n * @param {Object} props The component props.\n * @param {Function} props.taxonomyWrapper The wrapper function for each taxonomy component.\n *\n * @return {Array} An array of JSX elements representing the visible taxonomies.\n */\nexport default PostTaxonomies;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,yBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAZnD;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAMQ,QAAQ,GAAKC,CAAC,IAAMA,CAAC;AAEpB,SAASC,cAAcA,CAAE;EAAEC,eAAe,GAAGH;AAAS,CAAC,EAAG;EAChE,MAAM;IAAEI,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzD,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;MACpDJ,UAAU,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,aAAa,CAAE;QAAEC,QAAQ,EAAE,CAAC;MAAE,CAAE;IACjE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,iBAAiB,GAAG,CAAER,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,EAAE,EAAGS,MAAM,CAClDC,QAAQ;EACT;EACA;EACAA,QAAQ,CAACC,KAAK,CAACC,QAAQ,CAAEb,QAAS,CAAC,IAAIW,QAAQ,CAACG,UAAU,EAAEC,OAC9D,CAAC;EAED,OAAON,iBAAiB,CAACO,GAAG,CAAIL,QAAQ,IAAM;IAC7C,MAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAY,GAC5CC,iCAAwB,GACxBC,yBAAgB;IACnB,MAAMC,sBAAsB,GAAG;MAC9BC,IAAI,EAAEX,QAAQ,CAACW,IAAI;MACnB,IAAKX,QAAQ,CAACO,YAAY,GACvB,CAAC,CAAC,GACF;QAAEK,uBAAuB,EAAE;MAAK,CAAC;IACrC,CAAC;IAED,oBACC,IAAA5B,WAAA,CAAA6B,GAAA,EAACrC,QAAA,CAAAsC,QAAQ;MAAAC,QAAA,EACN3B,eAAe,eAChB,IAAAJ,WAAA,CAAA6B,GAAA,EAACP,iBAAiB;QAAA,GAAMI;MAAsB,CAAI,CAAC,EACnDV,QACD;IAAC,GAJe,YAAYA,QAAQ,CAACW,IAAM,EAKlC,CAAC;EAEb,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQe/B,cAAc","ignoreList":[]}
@@ -61,10 +61,10 @@ function BlockThemeControl({
61
61
  const {
62
62
  setRenderingMode
63
63
  } = (0, _data.useDispatch)(_store.store);
64
- const canCreateTemplate = (0, _data.useSelect)(select => {
65
- var _select$canUser;
66
- return (_select$canUser = select(_coreData.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
67
- });
64
+ const canCreateTemplate = (0, _data.useSelect)(select => !!select(_coreData.store).canUser('create', {
65
+ kind: 'postType',
66
+ name: 'wp_template'
67
+ }), []);
68
68
  if (!hasResolved) {
69
69
  return null;
70
70
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","canCreateTemplate","_select$canUser","coreStore","canUser","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","jsx","DropdownMenu","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","type","actions","default","check","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;A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_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","jsx","DropdownMenu","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","type","actions","default","check","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\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YACfT,gBAAgB,CACfnB,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;UACF,CAAG;UAAA2C,QAAA,EAED,IAAAhB,QAAE,EAAE,eAAgB;QAAC,CACd;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -42,7 +42,10 @@ function PostTemplateToggle({
42
42
  if (!supportsTemplateMode && availableTemplates[templateSlug]) {
43
43
  return availableTemplates[templateSlug];
44
44
  }
45
- const template = select(_coreData.store).canUser('create', 'templates') && select(_store.store).getCurrentTemplateId();
45
+ const template = select(_coreData.store).canUser('create', {
46
+ kind: 'postType',
47
+ name: 'wp_template'
48
+ }) && select(_store.store).getCurrentTemplateId();
46
49
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
47
50
  }, []);
48
51
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
@@ -83,7 +86,10 @@ function PostTemplateDropdownContent({
83
86
  getEntityRecords
84
87
  } = select(_coreData.store);
85
88
  const editorSettings = select(_store.store).getEditorSettings();
86
- const canCreateTemplates = canUser('create', 'templates');
89
+ const canCreateTemplates = canUser('create', {
90
+ kind: 'postType',
91
+ name: 'wp_template'
92
+ });
87
93
  const _currentTemplateId = select(_store.store).getCurrentTemplateId();
88
94
  return {
89
95
  availableTemplates: editorSettings.availableTemplates,
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","Dropdown","popoverProps","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,M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","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","kind","name","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","Dropdown","popoverProps","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAqD,IAAAY,WAAA,GAAAZ,OAAA;AAjBrD;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMa,aAAa,GAAG;EACrBC,SAAS,EAAE,gCAAgC;EAC3CC,SAAS,EAAE;AACZ,CAAC;AAED,SAASC,kBAAkBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAClD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9C,MAAMC,YAAY,GACjBD,MAAM,CAAEE,YAAY,CAAC,CAACC,sBAAsB,CAAE,UAAW,CAAC;IAE3D,MAAM;MAAEC,oBAAoB;MAAEC;IAAmB,CAAC,GACjDL,MAAM,CAAEE,YAAY,CAAC,CAACI,iBAAiB,CAAC,CAAC;IAC1C,IAAK,CAAEF,oBAAoB,IAAIC,kBAAkB,CAAEJ,YAAY,CAAE,EAAG;MACnE,OAAOI,kBAAkB,CAAEJ,YAAY,CAAE;IAC1C;IACA,MAAMM,QAAQ,GACbP,MAAM,CAAEQ,eAAU,CAAC,CAACC,OAAO,CAAE,QAAQ,EAAE;MACtCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,IAAIX,MAAM,CAAEE,YA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AAA,EAACnC,WAAA,CAAAmG,QAAQ;IACRC,YAAY,EAAGxF,aAAe;IAC9ByF,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEtF,MAAM;MAAEuF;IAAS,CAAC,kBACpC,IAAA5F,WAAA,CAAAwB,GAAA,EAACpB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGsF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE9D;IAAQ,CAAC,kBAC5B,IAAA/B,WAAA,CAAAwB,GAAA,EAACM,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAA+D,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAOeC,mBAAmB","ignoreList":[]}
@@ -31,7 +31,10 @@ function CreateNewTemplate({
31
31
  canUser
32
32
  } = select(_coreData.store);
33
33
  return {
34
- canCreateTemplates: canUser('create', 'templates')
34
+ canCreateTemplates: canUser('create', {
35
+ kind: 'postType',
36
+ name: 'wp_template'
37
+ })
35
38
  };
36
39
  }, []);
37
40
  const [isCreateModalOpen, setIsCreateModalOpen] = (0, _element.useState)(false);
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","CreateNewTemplate","onClick","canCreateTemplates","useSelect","select","canUser","coreStore","isCreateModalOpen","setIsCreateModalOpen","useState","allowSwitchingTemplate","useAllowSwitchingTemplates","jsxs","Fragment","children","jsx","MenuItem","__","default","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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,uBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAqD,IAAAQ,WAAA,GAAAR,OAAA;AAbrD;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASS,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACvC,OAAO;MACNJ,kBAAkB,EAAEG,OAAO,CAAE,QAAQ,EAAE,WAAY;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEE,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAMC,sBAAsB,GAAG,IAAAC,iCAA0B,EAAC,CAAC;;EAE3D;EACA,IAAK,CAAET,kBAAkB,IAAI,CAAEQ,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACC,IAAAX,WAAA,CAAAa,IAAA,EAAAb,WAAA,CAAAc,QAAA;IAAAC,QAAA,gBACC,IAAAf,WAAA,CAAAgB,GAAA,EAACzB,WAAA,CAAA0B,QAAQ;MACRf,OAAO,EAAGA,CAAA,KAAM;QACfO,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAM,QAAA,EAED,IAAAG,QAAE,EAAE,qBAAsB;IAAC,CACpB,CAAC,EAETV,iBAAiB,iBAClB,IAAAR,WAAA,CAAAgB,GAAA,EAACnB,uBAAA,CAAAsB,OAAsB;MACtBC,OAAO,EAAGA,CAAA,KAAM;QACfX,oBAAoB,CAAE,KAAM,CAAC;QAC7BP,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","CreateNewTemplate","onClick","canCreateTemplates","useSelect","select","canUser","coreStore","kind","name","isCreateModalOpen","setIsCreateModalOpen","useState","allowSwitchingTemplate","useAllowSwitchingTemplates","jsxs","Fragment","children","jsx","MenuItem","__","default","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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,uBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAqD,IAAAQ,WAAA,GAAAR,OAAA;AAbrD;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASS,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACvC,OAAO;MACNJ,kBAAkB,EAAEG,OAAO,CAAE,QAAQ,EAAE;QACtCE,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;MACP,CAAE;IACH,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAMC,sBAAsB,GAAG,IAAAC,iCAA0B,EAAC,CAAC;;EAE3D;EACA,IAAK,CAAEX,kBAAkB,IAAI,CAAEU,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACC,IAAAb,WAAA,CAAAe,IAAA,EAAAf,WAAA,CAAAgB,QAAA;IAAAC,QAAA,gBACC,IAAAjB,WAAA,CAAAkB,GAAA,EAAC3B,WAAA,CAAA4B,QAAQ;MACRjB,OAAO,EAAGA,CAAA,KAAM;QACfS,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAM,QAAA,EAED,IAAAG,QAAE,EAAE,qBAAsB;IAAC,CACpB,CAAC,EAETV,iBAAiB,iBAClB,IAAAV,WAAA,CAAAkB,GAAA,EAACrB,uBAAA,CAAAwB,OAAsB;MACtBC,OAAO,EAAGA,CAAA,KAAM;QACfX,oBAAoB,CAAE,KAAM,CAAC;QAC7BT,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -38,10 +38,14 @@ function useAllowSwitchingTemplates() {
38
38
  } = useEditedPostContext();
39
39
  return (0, _data.useSelect)(select => {
40
40
  const {
41
+ canUser,
41
42
  getEntityRecord,
42
43
  getEntityRecords
43
44
  } = select(_coreData.store);
44
- const siteSettings = getEntityRecord('root', 'site');
45
+ const siteSettings = canUser('read', {
46
+ kind: 'root',
47
+ name: 'site'
48
+ }) ? getEntityRecord('root', 'site') : undefined;
45
49
  const templates = getEntityRecords('postType', 'wp_template', {
46
50
  per_page: -1
47
51
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_coreData","_store","useEditedPostContext","useSelect","select","getCurrentPostId","getCurrentPostType","editorStore","postId","postType","useAllowSwitchingTemplates","getEntityRecord","getEntityRecords","coreStore","siteSettings","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","useMemo","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":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAA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 {"version":3,"names":["_data","require","_element","_coreData","_store","useEditedPostContext","useSelect","select","getCurrentPostId","getCurrentPostType","editorStore","postId","postType","useAllowSwitchingTemplates","canUser","getEntityRecord","getEntityRecords","coreStore","siteSettings","kind","name","undefined","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","useMemo","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":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA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QAAQ,CAACT,IAAI,KAAKa,cAAe,CAAC,EACvEb,IAAI;AACR","ignoreList":[]}
@@ -54,12 +54,18 @@ var _jsxRuntime = require("react/jsx-runtime");
54
54
  if (!settings.supportsTemplateMode) {
55
55
  return false;
56
56
  }
57
- const canCreateTemplates = (_select$canUser = select(_coreData.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
57
+ const canCreateTemplates = (_select$canUser = select(_coreData.store).canUser('create', {
58
+ kind: 'postType',
59
+ name: 'wp_template'
60
+ })) !== null && _select$canUser !== void 0 ? _select$canUser : false;
58
61
  return canCreateTemplates;
59
62
  }, []);
60
63
  const canViewTemplates = (0, _data.useSelect)(select => {
61
64
  var _select$canUser2;
62
- return (_select$canUser2 = select(_coreData.store).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
65
+ return (_select$canUser2 = select(_coreData.store).canUser('read', {
66
+ kind: 'postType',
67
+ name: 'wp_template'
68
+ })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
63
69
  }, []);
64
70
  if ((!isBlockTheme || !canViewTemplates) && isVisible) {
65
71
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelRow.default, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_postPanelRow","_jsxRuntime","PostTemplatePanel","templateId","isBlockTheme","useSelect","select","getCurrentTemplateId","getEditorSettings","editorStore","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","canViewTemplates","_select$canUser2","jsx","default","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<BlockThemeContro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AAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_i18n","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_postPanelRow","_jsxRuntime","PostTemplatePanel","templateId","isBlockTheme","useSelect","select","getCurrentTemplateId","getEditorSettings","editorStore","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","jsx","default","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,aAAA,GAAAF,sBAAA,CAAAL,OAAA;AAA6C,IAAAQ,WAAA,GAAAR,OAAA;AAb7C;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASS,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,UAAU;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7D,MAAM;MAAEC,oB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,eAAU,CAAC,CAACW,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,CAAE3B,YAAY,IAAI,CAAE0B,gBAAgB,KAAMnB,SAAS,EAAG;IAC5D,oBACC,IAAAV,WAAA,CAAA+B,GAAA,EAAChC,aAAA,CAAAiC,OAAY;MAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;MAAAC,QAAA,eACvC,IAAAnC,WAAA,CAAA+B,GAAA,EAACnC,aAAA,CAAAoC,OAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAK7B,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACC,IAAAF,WAAA,CAAA+B,GAAA,EAAChC,aAAA,CAAAiC,OAAY;MAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;MAAAC,QAAA,eACvC,IAAAnC,WAAA,CAAA+B,GAAA,EAACjC,WAAA,CAAAkC,OAAiB;QAACI,EAAE,EAAGlC;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -88,22 +88,14 @@ function PostTitle(_, forwardedRef) {
88
88
  const clipboardData = event.clipboardData;
89
89
  let plainText = '';
90
90
  let html = '';
91
-
92
- // IE11 only supports `Text` as an argument for `getData` and will
93
- // otherwise throw an invalid argument error, so we try the standard
94
- // arguments first, then fallback to `Text` if they fail.
95
91
  try {
96
92
  plainText = clipboardData.getData('text/plain');
97
93
  html = clipboardData.getData('text/html');
98
- } catch (error1) {
99
- try {
100
- html = clipboardData.getData('Text');
101
- } catch (error2) {
102
- // Some browsers like UC Browser paste plain text by default and
103
- // don't support clipboardData at all, so allow default
104
- // behaviour.
105
- return;
106
- }
94
+ } catch (error) {
95
+ // Some browsers like UC Browser paste plain text by default and
96
+ // don't support clipboardData at all, so allow default
97
+ // behaviour.
98
+ return;
107
99
  }
108
100
 
109
101
  // Allows us to ask for this information when we get a report.
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","_jsxRuntime","PostTitle","_","forwardedRef","placeholder","useSelect","select","getSettings","blockEditorStore","titlePlaceholder","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","title","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","onChange","value","replace","REGEXP_NEWLINES","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","clsx","DEFAULT_CLASSNAMES","jsx","default","supportKeys","children","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","exports","forwardRef"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AAKA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,qBAAA,GAAAf,sBAAA,CAAAC,OAAA;AAA8D,IAAAe,WAAA,GAAAf,OAAA;AA7B9D;AACA;AACA;;AAEA;AACA;AACA;;AAiBA;AACA;AACA;;AAMA,SAASgB,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAChD,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAClD,MAAM;MAAEC;IAAiB,CAAC,GAAGF,WAAW,CAAC,CAAC;IAE1C,OAAO;MACNH,WAAW,EAAEK;IACd,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEvD,MAAM;IAAEC,GAAG,EAAEC;EAAS,CAAC,GAAG,IAAAC,0BAAiB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ACnF,qBAAA,CAAAoF,OAAoB;MAACC,WAAW,EAAC,OAAO;MAAAC,QAAA,eACxC,IAAArF,WAAA,CAAAkF,GAAA;QACCrE,GAAG,EAAG,IAAAyE,qBAAY,EAAE,CAAEhB,WAAW,EAAExD,QAAQ,CAAG,CAAG;QACjDyE,eAAe;QACfR,SAAS,EAAGA,SAAW;QACvB,cAAaZ,kBAAoB;QACjCqB,IAAI,EAAC,SAAS;QACd,kBAAe,MAAM;QACrBC,OAAO,EAAGzD,QAAU;QACpB0D,MAAM,EAAGzD,UAAY;QACrBG,SAAS,EAAGA,SAAW;QACvBuD,UAAU,EAAG1D,UAAY;QACzBQ,OAAO,EAAGA;MAAS,CACnB;IAAC,CACmB;IACtB;EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAmD,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAQe,IAAAW,mBAAU,EAAE7F,SAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","_jsxRuntime","PostTitle","_","forwardedRef","placeholder","useSelect","select","getSettings","blockEditorStore","titlePlaceholder","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","title","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","onChange","value","replace","REGEXP_NEWLINES","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","clsx","DEFAULT_CLASSNAMES","jsx","default","supportKeys","children","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","exports","forwardRef"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AAKA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,aAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,qBAAA,GAAAf,sBAAA,CAAAC,OAAA;AAA8D,IAAAe,WAAA,GAAAf,OAAA;AA7B9D;AACA;AACA;;AAEA;AACA;AACA;;AAiBA;AACA;AACA;;AAMA,SAASgB,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAChD,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,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;EAEH;EACA;EACA,MAAMC,SAAS,GAAG,IAAAC,aAAI,EAAEC,6BAAkB,EAAE;IAC3C,aAAa,EAAEtE;EAChB,CAAE,CAAC;EAEH;IAAA;IACC;IACA,IAAAV,WAAA,CAAAiF,GAAA,EAAClF,qBAAA,CAAAmF,OAAoB;MAACC,WAAW,EAAC,OAAO;MAAAC,QAAA,eACxC,IAAApF,WAAA,CAAAiF,GAAA;QACCpE,GAAG,EAAG,IAAAwE,qBAAY,EAAE,CAAEhB,WAAW,EAAEvD,QAAQ,CAAG,CAAG;QACjDwE,eAAe;QACfR,SAAS,EAAGA,SAAW;QACvB,cAAaZ,kBAAoB;QACjCqB,IAAI,EAAC,SAAS;QACd,kBAAe,MAAM;QACrBC,OAAO,EAAGxD,QAAU;QACpByD,MAAM,EAAGxD,UAAY;QACrBG,SAAS,EAAGA,SAAW;QACvBsD,UAAU,EAAGzD,UAAY;QACzBQ,OAAO,EAAGA;MAAS,CACnB;IAAC,CACmB;IACtB;EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAkD,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAQe,IAAAW,mBAAU,EAAE5F,SAAU,CAAC","ignoreList":[]}
@@ -35,14 +35,16 @@ function PostTrashCheck({
35
35
  getCurrentPostType
36
36
  } = select(_store.store);
37
37
  const {
38
- getPostType,
39
38
  canUser
40
39
  } = select(_coreData.store);
41
- const postType = getPostType(getCurrentPostType());
40
+ const postType = getCurrentPostType();
42
41
  const postId = getCurrentPostId();
43
42
  const isNew = isEditedPostNew();
44
- const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
45
- const canUserDelete = postId && resource ? canUser('delete', resource, postId) : false;
43
+ const canUserDelete = !!postId ? canUser('delete', {
44
+ kind: 'postType',
45
+ name: postType,
46
+ id: postId
47
+ }) : false;
46
48
  return {
47
49
  canTrashPost: (!isNew || postId) && canUserDelete
48
50
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_store","PostTrashCheck","children","canTrashPost","useSelect","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","editorStore","getPostType","canUser","coreStore","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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEI,YAAY,CAAC;IACtB,MAAM;MAAEC,WAAW;MAAEC;IAAQ,CAAC,GAAGN,MAAM,CAAEO,eAAU,CAAC;IACpD,MAAMC,QAAQ,GAAGH,WAAW,CAAEF,kBAAkB,CAAC,CAAE,CAAC;IACpD,MAAMM,MAAM,GAAGP,gBAAgB,CAAC,CAAC;IACjC,MAAMQ,KAAK,GAAGT,eAAe,CAAC,CAAC;IAC/B,MAAMU,QAAQ,GAAGH,QAAQ,EAAEI,SAAS,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAMC,aAAa,GAClBJ,MAAM,IAAIE,QAAQ,GAAGL,OAAO,CAAE,QAAQ,EAAEK,QAAQ,EAAEF,MAAO,CAAC,GAAG,KAAK;IAEnE,OAAO;MACNX,YAAY,EAAE,CAAE,CAAEY,KAAK,IAAID,MAAM,KAAMI;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEf,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_store","PostTrashCheck","children","canTrashPost","useSelect","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","editorStore","canUser","coreStore","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":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEI,YAAY,CAAC;IACtB,MAAM;MAAEC;IAAQ,CAAC,GAAGL,MAAM,CAAEM,eAAU,CAAC;IACvC,MAAMC,QAAQ,GAAGJ,kBAAkB,CAAC,CAAC;IACrC,MAAMK,MAAM,GAAGN,gBAAgB,CAAC,CAAC;IACjC,MAAMO,KAAK,GAAGR,eAAe,CAAC,CAAC;IAC/B,MAAMS,aAAa,GAAG,CAAC,CAAEF,MAAM,GAC5BH,OAAO,CAAE,QAAQ,EAAE;MACnBM,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAEL,QAAQ;MACdM,EAAE,EAAEL;IACJ,CAAE,CAAC,GACH,KAAK;IAER,OAAO;MACNV,YAAY,EAAE,CAAE,CAAEW,KAAK,IAAID,MAAM,KAAME;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
@@ -80,9 +80,13 @@ function PostURLToggle({
80
80
  getCurrentPost
81
81
  } = select(_store.store);
82
82
  const {
83
- getEditedEntityRecord
83
+ getEditedEntityRecord,
84
+ canUser
84
85
  } = select(_coreData.store);
85
- const siteSettings = getEditedEntityRecord('root', 'site');
86
+ const siteSettings = canUser('read', {
87
+ kind: 'root',
88
+ name: 'site'
89
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
86
90
  const _id = getCurrentPostId();
87
91
  return {
88
92
  slug: select(_store.store).getEditedPostSlug(),
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","jsx","default","children","label","__","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","useSelect","select","getCurrentPostId","getCurrentPost","editorStore","getEditedEntityRecord","coreStore","siteSettings","_id","getEditedPostSlug","page_on_front","link","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","jsxs","Fragment"],"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 : <>/{ decodedSlug }</> }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAhBnD;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASY,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC5D;EACA,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,OAAQ;IACP;IACA;IACAC,MAAM,EAAEL,aAAa;IACrBM,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE;EACR,CAAC,CAAE,EACH,CAAER,aAAa,CAChB,CAAC;EAED,oBACC,IAAAF,WAAA,CAAAW,GAAA,EAAChB,MAAA,CAAAiB,OAAY;IAAAC,QAAA,eACZ,IAAAb,WAAA,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CAAC,CAAC,EAAEQ;IAC7B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,WAAW,GAAG,IAAAC,2BAAsB,EAAEhB,IAAK,CAAC;EAClD,oBACC,IAAA5B,WAAA,CAAAW,GAAA,EAACpB,WAAA,CAAAsD,MAAM;IACNC,IAAI,EAAC,SAAS;IACd5B,SAAS,EAAC,+BAA+B;IACzC6B,OAAO,EAAC,UAAU;IAClB,iBAAgBzB;IAChB;IAAA;IACA,cAAa,IAAA0B,aAAO,EAAE,IAAAjC,QAAE,EAAE,iBAAkB,CAAC,EAAE4B,WAAY,CAAG;IAC9DlB,OAAO,EAAGA,OAAS;IAAAZ,QAAA,EAEjBgB,WAAW,GAAGC,QAAQ,gBAAG,IAAA9B,WAAA,CAAAiD,IAAA,EAAAjD,WAAA,CAAAkD,QAAA;MAAArC,QAAA,GAAE,GAAC,EAAE8B,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","jsx","default","children","label","__","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","useSelect","select","getCurrentPostId","getCurrentPost","editorStore","getEditedEntityRecord","canUser","coreStore","siteSettings","kind","name","undefined","_id","getEditedPostSlug","page_on_front","link","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","jsxs","Fragment"],"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' ), decodedSlug ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ isFrontPage ? postLink : <>/{ decodedSlug }</> }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAhBnD;AACA;AACA;;AAQA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASY,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC5D;EACA,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,OAAQ;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AY,GAAGF,OAAO,CAAE,MAAM,EAAE;MACrCG,IAAI,EAAE,MAAM;MACZC,IAAI,EAAE;IACP,CAAE,CAAC,GACAL,qBAAqB,CAAE,MAAM,EAAE,MAAO,CAAC,GACvCM,SAAS;IACZ,MAAMC,GAAG,GAAGV,gBAAgB,CAAC,CAAC;IAC9B,OAAO;MACNL,IAAI,EAAEI,MAAM,CAAEG,YAAY,CAAC,CAACS,iBAAiB,CAAC,CAAC;MAC/Cf,WAAW,EAAEU,YAAY,EAAEM,aAAa,KAAKF,GAAG;MAChDb,QAAQ,EAAEI,cAAc,CAAC,CAAC,EAAEY;IAC7B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,WAAW,GAAG,IAAAC,2BAAsB,EAAEpB,IAAK,CAAC;EAClD,oBACC,IAAA5B,WAAA,CAAAW,GAAA,EAACpB,WAAA,CAAA0D,MAAM;IACNC,IAAI,EAAC,SAAS;IACdhC,SAAS,EAAC,+BAA+B;IACzCiC,OAAO,EAAC,UAAU;IAClB,iBAAgB7B;IAChB;IAAA;IACA,cAAa,IAAA8B,aAAO,EAAE,IAAArC,QAAE,EAAE,iBAAkB,CAAC,EAAEgC,WAAY,CAAG;IAC9DtB,OAAO,EAAGA,OAAS;IAAAZ,QAAA,EAEjBgB,WAAW,GAAGC,QAAQ,gBAAG,IAAA9B,WAAA,CAAAqD,IAAA,EAAArD,WAAA,CAAAsD,QAAA;MAAAzC,QAAA,GAAE,GAAC,EAAEkC,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
@@ -37,9 +37,13 @@ function PostsPerPage() {
37
37
  getCurrentPostType
38
38
  } = select(_store.store);
39
39
  const {
40
- getEditedEntityRecord
40
+ getEditedEntityRecord,
41
+ canUser
41
42
  } = select(_coreData.store);
42
- const siteSettings = getEditedEntityRecord('root', 'site');
43
+ const siteSettings = canUser('read', {
44
+ kind: 'root',
45
+ name: 'site'
46
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
43
47
  return {
44
48
  isTemplate: getCurrentPostType() === _constants.TEMPLATE_POST_TYPE,
45
49
  postSlug: getEditedPostAttribute('slug'),