@wordpress/editor 14.3.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 (400) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -1
  3. package/build/bindings/api.js +65 -0
  4. package/build/bindings/api.js.map +1 -0
  5. package/build/bindings/pattern-overrides.js +23 -13
  6. package/build/bindings/pattern-overrides.js.map +1 -1
  7. package/build/bindings/post-meta.js +23 -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/global-styles-provider/index.js +15 -3
  16. package/build/components/global-styles-provider/index.js.map +1 -1
  17. package/build/components/header/back-button.js +7 -8
  18. package/build/components/header/back-button.js.map +1 -1
  19. package/build/components/header/index.js +19 -17
  20. package/build/components/header/index.js.map +1 -1
  21. package/build/components/page-attributes/order.js +1 -67
  22. package/build/components/page-attributes/order.js.map +1 -1
  23. package/build/components/page-attributes/panel.js +1 -4
  24. package/build/components/page-attributes/panel.js.map +1 -1
  25. package/build/components/post-actions/actions.js +126 -33
  26. package/build/components/post-actions/actions.js.map +1 -1
  27. package/build/components/post-card-panel/index.js +8 -2
  28. package/build/components/post-card-panel/index.js.map +1 -1
  29. package/build/components/post-comments/index.js +1 -1
  30. package/build/components/post-comments/index.js.map +1 -1
  31. package/build/components/post-content-information/index.js +7 -1
  32. package/build/components/post-content-information/index.js.map +1 -1
  33. package/build/components/post-discussion/panel.js +2 -2
  34. package/build/components/post-discussion/panel.js.map +1 -1
  35. package/build/components/post-excerpt/panel.js +1 -1
  36. package/build/components/post-excerpt/panel.js.map +1 -1
  37. package/build/components/post-featured-image/index.js +3 -1
  38. package/build/components/post-featured-image/index.js.map +1 -1
  39. package/build/components/post-last-revision/index.js +2 -1
  40. package/build/components/post-last-revision/index.js.map +1 -1
  41. package/build/components/post-publish-button/index.js +4 -11
  42. package/build/components/post-publish-button/index.js.map +1 -1
  43. package/build/components/post-publish-panel/maybe-category-panel.js +4 -1
  44. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  45. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -1
  46. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  47. package/build/components/post-status/index.js +30 -10
  48. package/build/components/post-status/index.js.map +1 -1
  49. package/build/components/post-taxonomies/flat-term-selector.js +17 -6
  50. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  51. package/build/components/post-taxonomies/index.js +7 -1
  52. package/build/components/post-taxonomies/index.js.map +1 -1
  53. package/build/components/post-template/block-theme.js +4 -4
  54. package/build/components/post-template/block-theme.js.map +1 -1
  55. package/build/components/post-template/classic-theme.js +8 -2
  56. package/build/components/post-template/classic-theme.js.map +1 -1
  57. package/build/components/post-template/create-new-template.js +4 -1
  58. package/build/components/post-template/create-new-template.js.map +1 -1
  59. package/build/components/post-template/hooks.js +5 -1
  60. package/build/components/post-template/hooks.js.map +1 -1
  61. package/build/components/post-template/panel.js +8 -2
  62. package/build/components/post-template/panel.js.map +1 -1
  63. package/build/components/post-trash/check.js +6 -4
  64. package/build/components/post-trash/check.js.map +1 -1
  65. package/build/components/post-url/panel.js +6 -2
  66. package/build/components/post-url/panel.js.map +1 -1
  67. package/build/components/posts-per-page/index.js +6 -2
  68. package/build/components/posts-per-page/index.js.map +1 -1
  69. package/build/components/provider/use-block-editor-settings.js +15 -6
  70. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  71. package/build/components/save-publish-panels/index.js +1 -2
  72. package/build/components/save-publish-panels/index.js.map +1 -1
  73. package/build/components/sidebar/index.js +3 -9
  74. package/build/components/sidebar/index.js.map +1 -1
  75. package/build/components/site-discussion/index.js +7 -3
  76. package/build/components/site-discussion/index.js.map +1 -1
  77. package/build/components/template-content-panel/index.js +5 -5
  78. package/build/components/template-content-panel/index.js.map +1 -1
  79. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -4
  80. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  81. package/build/components/visual-editor/index.js +5 -2
  82. package/build/components/visual-editor/index.js.map +1 -1
  83. package/build/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  84. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  85. package/build/dataviews/actions/delete-post.js +2 -0
  86. package/build/dataviews/actions/delete-post.js.map +1 -1
  87. package/build/hooks/pattern-overrides.js +1 -1
  88. package/build/hooks/pattern-overrides.js.map +1 -1
  89. package/build/index.js +0 -1
  90. package/build/index.js.map +1 -1
  91. package/build/private-apis.js +3 -0
  92. package/build/private-apis.js.map +1 -1
  93. package/build/utils/media-upload/index.js +35 -2
  94. package/build/utils/media-upload/index.js.map +1 -1
  95. package/build-module/bindings/api.js +57 -0
  96. package/build-module/bindings/api.js.map +1 -0
  97. package/build-module/bindings/pattern-overrides.js +23 -13
  98. package/build-module/bindings/pattern-overrides.js.map +1 -1
  99. package/build-module/bindings/post-meta.js +23 -12
  100. package/build-module/bindings/post-meta.js.map +1 -1
  101. package/build-module/components/block-settings-menu/content-only-settings-menu.js +4 -1
  102. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  103. package/build-module/components/blog-title/index.js +6 -2
  104. package/build-module/components/blog-title/index.js.map +1 -1
  105. package/build-module/components/collapsible-block-toolbar/index.js +1 -2
  106. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  107. package/build-module/components/global-styles-provider/index.js +15 -3
  108. package/build-module/components/global-styles-provider/index.js.map +1 -1
  109. package/build-module/components/header/back-button.js +5 -7
  110. package/build-module/components/header/back-button.js.map +1 -1
  111. package/build-module/components/header/index.js +19 -19
  112. package/build-module/components/header/index.js.map +1 -1
  113. package/build-module/components/page-attributes/order.js +4 -70
  114. package/build-module/components/page-attributes/order.js.map +1 -1
  115. package/build-module/components/page-attributes/panel.js +1 -6
  116. package/build-module/components/page-attributes/panel.js.map +1 -1
  117. package/build-module/components/post-actions/actions.js +127 -34
  118. package/build-module/components/post-actions/actions.js.map +1 -1
  119. package/build-module/components/post-card-panel/index.js +8 -2
  120. package/build-module/components/post-card-panel/index.js.map +1 -1
  121. package/build-module/components/post-comments/index.js +2 -2
  122. package/build-module/components/post-comments/index.js.map +1 -1
  123. package/build-module/components/post-content-information/index.js +7 -1
  124. package/build-module/components/post-content-information/index.js.map +1 -1
  125. package/build-module/components/post-discussion/panel.js +3 -3
  126. package/build-module/components/post-discussion/panel.js.map +1 -1
  127. package/build-module/components/post-excerpt/panel.js +1 -1
  128. package/build-module/components/post-excerpt/panel.js.map +1 -1
  129. package/build-module/components/post-featured-image/index.js +3 -1
  130. package/build-module/components/post-featured-image/index.js.map +1 -1
  131. package/build-module/components/post-last-revision/index.js +2 -1
  132. package/build-module/components/post-last-revision/index.js.map +1 -1
  133. package/build-module/components/post-publish-button/index.js +4 -11
  134. package/build-module/components/post-publish-button/index.js.map +1 -1
  135. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -1
  136. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  137. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -1
  138. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  139. package/build-module/components/post-status/index.js +30 -10
  140. package/build-module/components/post-status/index.js.map +1 -1
  141. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -6
  142. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  143. package/build-module/components/post-taxonomies/index.js +7 -1
  144. package/build-module/components/post-taxonomies/index.js.map +1 -1
  145. package/build-module/components/post-template/block-theme.js +4 -4
  146. package/build-module/components/post-template/block-theme.js.map +1 -1
  147. package/build-module/components/post-template/classic-theme.js +8 -2
  148. package/build-module/components/post-template/classic-theme.js.map +1 -1
  149. package/build-module/components/post-template/create-new-template.js +4 -1
  150. package/build-module/components/post-template/create-new-template.js.map +1 -1
  151. package/build-module/components/post-template/hooks.js +5 -1
  152. package/build-module/components/post-template/hooks.js.map +1 -1
  153. package/build-module/components/post-template/panel.js +8 -2
  154. package/build-module/components/post-template/panel.js.map +1 -1
  155. package/build-module/components/post-trash/check.js +6 -4
  156. package/build-module/components/post-trash/check.js.map +1 -1
  157. package/build-module/components/post-url/panel.js +6 -2
  158. package/build-module/components/post-url/panel.js.map +1 -1
  159. package/build-module/components/posts-per-page/index.js +6 -2
  160. package/build-module/components/posts-per-page/index.js.map +1 -1
  161. package/build-module/components/provider/use-block-editor-settings.js +15 -6
  162. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  163. package/build-module/components/save-publish-panels/index.js +1 -2
  164. package/build-module/components/save-publish-panels/index.js.map +1 -1
  165. package/build-module/components/sidebar/index.js +3 -9
  166. package/build-module/components/sidebar/index.js.map +1 -1
  167. package/build-module/components/site-discussion/index.js +8 -4
  168. package/build-module/components/site-discussion/index.js.map +1 -1
  169. package/build-module/components/template-content-panel/index.js +5 -5
  170. package/build-module/components/template-content-panel/index.js.map +1 -1
  171. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -4
  172. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  173. package/build-module/components/visual-editor/index.js +5 -2
  174. package/build-module/components/visual-editor/index.js.map +1 -1
  175. package/build-module/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  176. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  177. package/build-module/dataviews/actions/delete-post.js +2 -0
  178. package/build-module/dataviews/actions/delete-post.js.map +1 -1
  179. package/build-module/hooks/pattern-overrides.js +1 -1
  180. package/build-module/hooks/pattern-overrides.js.map +1 -1
  181. package/build-module/index.js +0 -1
  182. package/build-module/index.js.map +1 -1
  183. package/build-module/private-apis.js +3 -0
  184. package/build-module/private-apis.js.map +1 -1
  185. package/build-module/utils/media-upload/index.js +36 -3
  186. package/build-module/utils/media-upload/index.js.map +1 -1
  187. package/build-style/style-rtl.css +78 -42
  188. package/build-style/style.css +78 -42
  189. package/build-types/bindings/api.d.ts +25 -0
  190. package/build-types/bindings/api.d.ts.map +1 -0
  191. package/build-types/bindings/pattern-overrides.d.ts +5 -6
  192. package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
  193. package/build-types/bindings/post-meta.d.ts +5 -7
  194. package/build-types/bindings/post-meta.d.ts.map +1 -1
  195. package/build-types/components/autocompleters/user.d.ts +2 -2
  196. package/build-types/components/autocompleters/user.d.ts.map +1 -1
  197. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
  198. package/build-types/components/blog-title/index.d.ts.map +1 -1
  199. package/build-types/components/collapsible-block-toolbar/index.d.ts +1 -2
  200. package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -1
  201. package/build-types/components/document-bar/index.d.ts.map +1 -1
  202. package/build-types/components/document-outline/check.d.ts.map +1 -1
  203. package/build-types/components/document-outline/index.d.ts.map +1 -1
  204. package/build-types/components/editor-history/redo.d.ts +1 -1
  205. package/build-types/components/editor-history/undo.d.ts +1 -1
  206. package/build-types/components/editor-notices/index.d.ts.map +1 -1
  207. package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
  208. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  209. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  210. package/build-types/components/header/back-button.d.ts +1 -0
  211. package/build-types/components/header/back-button.d.ts.map +1 -1
  212. package/build-types/components/header/index.d.ts.map +1 -1
  213. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  214. package/build-types/components/media-categories/index.d.ts.map +1 -1
  215. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  216. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  217. package/build-types/components/page-attributes/check.d.ts.map +1 -1
  218. package/build-types/components/page-attributes/order.d.ts +1 -1
  219. package/build-types/components/page-attributes/order.d.ts.map +1 -1
  220. package/build-types/components/page-attributes/panel.d.ts.map +1 -1
  221. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  222. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  223. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  224. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  225. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  226. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  227. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
  228. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  229. package/build-types/components/post-author/check.d.ts.map +1 -1
  230. package/build-types/components/post-author/index.d.ts.map +1 -1
  231. package/build-types/components/post-author/panel.d.ts.map +1 -1
  232. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  233. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  234. package/build-types/components/post-discussion/panel.d.ts.map +1 -1
  235. package/build-types/components/post-excerpt/check.d.ts.map +1 -1
  236. package/build-types/components/post-excerpt/index.d.ts.map +1 -1
  237. package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
  238. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  239. package/build-types/components/post-featured-image/check.d.ts.map +1 -1
  240. package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
  241. package/build-types/components/post-format/index.d.ts.map +1 -1
  242. package/build-types/components/post-format/panel.d.ts.map +1 -1
  243. package/build-types/components/post-last-revision/check.d.ts.map +1 -1
  244. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  245. package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
  246. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  247. package/build-types/components/post-pending-status/check.d.ts.map +1 -1
  248. package/build-types/components/post-pending-status/index.d.ts.map +1 -1
  249. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  250. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  251. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  252. package/build-types/components/post-saved-state/index.d.ts +1 -1
  253. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  254. package/build-types/components/post-schedule/check.d.ts.map +1 -1
  255. package/build-types/components/post-schedule/index.d.ts.map +1 -1
  256. package/build-types/components/post-schedule/label.d.ts.map +1 -1
  257. package/build-types/components/post-schedule/panel.d.ts.map +1 -1
  258. package/build-types/components/post-slug/check.d.ts.map +1 -1
  259. package/build-types/components/post-slug/index.d.ts.map +1 -1
  260. package/build-types/components/post-status/index.d.ts.map +1 -1
  261. package/build-types/components/post-sticky/check.d.ts.map +1 -1
  262. package/build-types/components/post-sticky/index.d.ts.map +1 -1
  263. package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
  264. package/build-types/components/post-sync-status/index.d.ts.map +1 -1
  265. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  266. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +9 -7
  267. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  268. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +13 -11
  269. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  270. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  271. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  272. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  273. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  274. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  275. package/build-types/components/post-template/panel.d.ts.map +1 -1
  276. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  277. package/build-types/components/post-trash/check.d.ts.map +1 -1
  278. package/build-types/components/post-trash/index.d.ts.map +1 -1
  279. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  280. package/build-types/components/post-url/check.d.ts.map +1 -1
  281. package/build-types/components/post-url/index.d.ts.map +1 -1
  282. package/build-types/components/post-url/label.d.ts.map +1 -1
  283. package/build-types/components/post-url/panel.d.ts.map +1 -1
  284. package/build-types/components/post-visibility/check.d.ts.map +1 -1
  285. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  286. package/build-types/components/posts-per-page/index.d.ts.map +1 -1
  287. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  288. package/build-types/components/provider/index.d.ts.map +1 -1
  289. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  290. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  291. package/build-types/components/sidebar/index.d.ts.map +1 -1
  292. package/build-types/components/site-discussion/index.d.ts.map +1 -1
  293. package/build-types/components/template-content-panel/index.d.ts +1 -3
  294. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  295. package/build-types/components/theme-support-check/index.d.ts.map +1 -1
  296. package/build-types/components/time-to-read/index.d.ts.map +1 -1
  297. package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
  298. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
  299. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  300. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  301. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -0
  302. package/build-types/components/word-count/index.d.ts.map +1 -1
  303. package/build-types/dataviews/actions/delete-post.d.ts.map +1 -1
  304. package/build-types/dataviews/api.d.ts +1 -1
  305. package/build-types/dataviews/api.d.ts.map +1 -1
  306. package/build-types/dataviews/store/private-selectors.d.ts +0 -1
  307. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
  308. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +1 -1
  309. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
  310. package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
  311. package/build-types/private-apis.d.ts.map +1 -1
  312. package/build-types/store/actions.d.ts.map +1 -1
  313. package/build-types/store/private-actions.d.ts.map +1 -1
  314. package/build-types/store/reducer.d.ts.map +1 -1
  315. package/build-types/store/selectors.d.ts +0 -1
  316. package/build-types/store/selectors.d.ts.map +1 -1
  317. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  318. package/package.json +38 -37
  319. package/src/bindings/api.js +57 -0
  320. package/src/bindings/pattern-overrides.js +28 -17
  321. package/src/bindings/post-meta.js +19 -14
  322. package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
  323. package/src/components/blog-title/index.js +7 -2
  324. package/src/components/collapsible-block-toolbar/index.js +1 -3
  325. package/src/components/collapsible-block-toolbar/style.scss +0 -3
  326. package/src/components/document-bar/style.scss +1 -5
  327. package/src/components/document-tools/style.scss +4 -4
  328. package/src/components/editor-interface/style.scss +4 -0
  329. package/src/components/global-styles-provider/index.js +22 -11
  330. package/src/components/header/back-button.js +6 -6
  331. package/src/components/header/index.js +26 -25
  332. package/src/components/header/style.scss +64 -21
  333. package/src/components/inserter-sidebar/style.scss +1 -6
  334. package/src/components/page-attributes/order.js +3 -77
  335. package/src/components/page-attributes/panel.js +1 -7
  336. package/src/components/post-actions/actions.js +150 -32
  337. package/src/components/post-card-panel/index.js +8 -2
  338. package/src/components/post-comments/index.js +2 -2
  339. package/src/components/post-content-information/index.js +7 -1
  340. package/src/components/post-discussion/panel.js +5 -3
  341. package/src/components/post-excerpt/panel.js +2 -1
  342. package/src/components/post-featured-image/index.js +5 -1
  343. package/src/components/post-last-revision/index.js +1 -0
  344. package/src/components/post-panel-row/style.scss +0 -1
  345. package/src/components/post-publish-button/index.js +4 -17
  346. package/src/components/post-publish-panel/maybe-category-panel.js +4 -1
  347. package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
  348. package/src/components/post-status/index.js +18 -10
  349. package/src/components/post-taxonomies/flat-term-selector.js +19 -5
  350. package/src/components/post-taxonomies/index.js +8 -1
  351. package/src/components/post-template/block-theme.js +5 -1
  352. package/src/components/post-template/classic-theme.js +8 -3
  353. package/src/components/post-template/create-new-template.js +4 -1
  354. package/src/components/post-template/hooks.js +8 -2
  355. package/src/components/post-template/panel.js +10 -2
  356. package/src/components/post-trash/check.js +9 -5
  357. package/src/components/post-url/panel.js +7 -2
  358. package/src/components/posts-per-page/index.js +7 -2
  359. package/src/components/provider/use-block-editor-settings.js +15 -6
  360. package/src/components/save-publish-panels/index.js +1 -4
  361. package/src/components/sidebar/index.js +2 -5
  362. package/src/components/site-discussion/index.js +9 -4
  363. package/src/components/template-content-panel/index.js +3 -2
  364. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  365. package/src/components/visual-editor/index.js +5 -2
  366. package/src/components/visual-editor/style.scss +0 -1
  367. package/src/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  368. package/src/dataviews/actions/delete-post.tsx +2 -0
  369. package/src/hooks/pattern-overrides.js +1 -1
  370. package/src/index.js +0 -1
  371. package/src/private-apis.js +6 -0
  372. package/src/store/test/actions.js +9 -3
  373. package/src/utils/media-upload/index.js +38 -3
  374. package/tsconfig.tsbuildinfo +1 -1
  375. package/build/bindings/index.js +0 -22
  376. package/build/bindings/index.js.map +0 -1
  377. package/build/hooks/use-select-nearest-editable-block.js.map +0 -1
  378. package/build/store/utils/get-filtered-template-parts.js +0 -71
  379. package/build/store/utils/get-filtered-template-parts.js.map +0 -1
  380. package/build/utils/set-nested-value.js +0 -44
  381. package/build/utils/set-nested-value.js.map +0 -1
  382. package/build-module/bindings/index.js +0 -17
  383. package/build-module/bindings/index.js.map +0 -1
  384. package/build-module/hooks/use-select-nearest-editable-block.js.map +0 -1
  385. package/build-module/store/utils/get-filtered-template-parts.js +0 -64
  386. package/build-module/store/utils/get-filtered-template-parts.js.map +0 -1
  387. package/build-module/utils/set-nested-value.js +0 -38
  388. package/build-module/utils/set-nested-value.js.map +0 -1
  389. package/build-types/bindings/index.d.ts +0 -2
  390. package/build-types/bindings/index.d.ts.map +0 -1
  391. package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +0 -1
  392. package/build-types/store/utils/get-filtered-template-parts.d.ts +0 -3
  393. package/build-types/store/utils/get-filtered-template-parts.d.ts.map +0 -1
  394. package/build-types/utils/set-nested-value.d.ts +0 -20
  395. package/build-types/utils/set-nested-value.d.ts.map +0 -1
  396. package/src/bindings/index.js +0 -15
  397. package/src/store/utils/get-filtered-template-parts.js +0 -69
  398. package/src/store/utils/test/get-filtered-template-parts.js +0 -189
  399. package/src/utils/set-nested-value.js +0 -39
  400. /package/build-types/{hooks → components/visual-editor}/use-select-nearest-editable-block.d.ts +0 -0
@@ -25,7 +25,10 @@ export default function CreateNewTemplate({
25
25
  canUser
26
26
  } = select(coreStore);
27
27
  return {
28
- canCreateTemplates: canUser('create', 'templates')
28
+ canCreateTemplates: canUser('create', {
29
+ kind: 'postType',
30
+ name: 'wp_template'
31
+ })
29
32
  };
30
33
  }, []);
31
34
  const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","onClick","canCreateTemplates","select","canUser","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate( { onClick } ) {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: canUser( 'create', 'templates' ),\n\t\t};\n\t}, [] );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,eAAe,SAASC,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACvC,OAAO;MACNY,kBAAkB,EAAEE,OAAO,CAAE,QAAQ,EAAE,WAAY;IACpD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGf,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAMgB,sBAAsB,GAAGd,0BAA0B,CAAC,CAAC;;EAE3D;EACA,IAAK,CAAES,kBAAkB,IAAI,CAAEK,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACCR,KAAA,CAAAF,SAAA;IAAAW,QAAA,gBACCb,IAAA,CAACT,QAAQ;MACRe,OAAO,EAAGA,CAAA,KAAM;QACfK,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAE,QAAA,EAEDrB,EAAE,CAAE,qBAAsB;IAAC,CACpB,CAAC,EAETkB,iBAAiB,iBAClBV,IAAA,CAACH,sBAAsB;MACtBiB,OAAO,EAAGA,CAAA,KAAM;QACfH,oBAAoB,CAAE,KAAM,CAAC;QAC7BL,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["MenuItem","__","useSelect","store","coreStore","useState","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","CreateNewTemplate","onClick","canCreateTemplates","select","canUser","kind","name","isCreateModalOpen","setIsCreateModalOpen","allowSwitchingTemplate","children","onClose"],"sources":["@wordpress/editor/src/components/post-template/create-new-template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nexport default function CreateNewTemplate( { onClick } ) {\n\tconst { canCreateTemplates } = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\treturn {\n\t\t\tcanCreateTemplates: canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\n\t// The default template in a post is indicated by an empty string.\n\tif ( ! canCreateTemplates || ! allowSwitchingTemplate ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsCreateModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new template' ) }\n\t\t\t</MenuItem>\n\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsCreateModalOpen( false );\n\t\t\t\t\t\tonClick();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAErD,eAAe,SAASC,iBAAiBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACxD,MAAM;IAAEC;EAAmB,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACvD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACvC,OAAO;MACNY,kBAAkB,EAAEE,OAAO,CAAE,QAAQ,EAAE;QACtCC,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;MACP,CAAE;IACH,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGjB,QAAQ,CAAE,KAAM,CAAC;EACrE,MAAMkB,sBAAsB,GAAGhB,0BAA0B,CAAC,CAAC;;EAE3D;EACA,IAAK,CAAES,kBAAkB,IAAI,CAAEO,sBAAsB,EAAG;IACvD,OAAO,IAAI;EACZ;EACA,oBACCV,KAAA,CAAAF,SAAA;IAAAa,QAAA,gBACCf,IAAA,CAACT,QAAQ;MACRe,OAAO,EAAGA,CAAA,KAAM;QACfO,oBAAoB,CAAE,IAAK,CAAC;MAC7B,CAAG;MAAAE,QAAA,EAEDvB,EAAE,CAAE,qBAAsB;IAAC,CACpB,CAAC,EAEToB,iBAAiB,iBAClBZ,IAAA,CAACH,sBAAsB;MACtBmB,OAAO,EAAGA,CAAA,KAAM;QACfH,oBAAoB,CAAE,KAAM,CAAC;QAC7BP,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -28,10 +28,14 @@ export function useAllowSwitchingTemplates() {
28
28
  } = useEditedPostContext();
29
29
  return useSelect(select => {
30
30
  const {
31
+ canUser,
31
32
  getEntityRecord,
32
33
  getEntityRecords
33
34
  } = select(coreStore);
34
- const siteSettings = getEntityRecord('root', 'site');
35
+ const siteSettings = canUser('read', {
36
+ kind: 'root',
37
+ name: 'site'
38
+ }) ? getEntityRecord('root', 'site') : undefined;
35
39
  const templates = getEntityRecords('postType', 'wp_template', {
36
40
  per_page: -1
37
41
  });
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useMemo","store","coreStore","editorStore","useEditedPostContext","select","getCurrentPostId","getCurrentPostType","postId","postType","useAllowSwitchingTemplates","getEntityRecord","getEntityRecords","siteSettings","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","filter","template","is_custom","content","raw","entityTemplate","post","getEditedEntityRecord","find"],"sources":["@wordpress/editor/src/components/post-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEntityRecords } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' &&\n\t\t\t\t+postId === siteSettings?.page_on_front &&\n\t\t\t\ttemplates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! isFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t\tpost_type: postType,\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\ttemplate.is_custom &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEF,WAAY,CAAC;IACtE,OAAO;MACNK,MAAM,EAAEF,gBAAgB,CAAC,CAAC;MAC1BG,QAAQ,EAAEF,kBAAkB,CAAC;IAC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,YAAY,CAAEb,QAAS,CAAC;EAC1C,OAAOT,OAAO,CACb,MACC2B,sBAAsB,IACtBb,SAAS,EAAEc,MAAM,CACdC,QAAQ,IACTA,QAAQ,CAACC,SAAS,IAClBD,QAAQ,CAACR,IAAI,KAAKI,mBAAmB,IACrC,CAAC,CAAEI,QAAQ,CAACE,OAAO,CAACC,GAAG,CAAC;EAC1B,CAAC,EACF,CAAElB,SAAS,EAAEW,mBAAmB,EAAEE,sBAAsB,CACzD,CAAC;AACF;AAEA,OAAO,SAASD,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEjB,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,MAAMU,SAAS,GAAGQ,YAAY,CAAEb,QAAS,CAAC;EAC1C,MAAMwB,cAAc,GAAGlC,SAAS,CAC7BM,MAAM,IAAM;IACb,MAAM6B,IAAI,GAAG7B,MAAM,CAAEH,SAAU,CAAC,CAACiC,qBAAqB,CACrD,UAAU,EACV1B,QAAQ,EACRD,MACD,CAAC;IACD,OAAO0B,IAAI,EAAEL,QAAQ;EACtB,CAAC,EACD,CAAEpB,QAAQ,EAAED,MAAM,CACnB,CAAC;EAED,IAAK,CAAEyB,cAAc,EAAG;IACvB;EACD;EACA;EACA;EACA;EACA,OAAOnB,SAAS,EAAEsB,IAAI,CAAIP,QAAQ,IAAMA,QAAQ,CAACR,IAAI,KAAKY,cAAe,CAAC,EACvEZ,IAAI;AACR","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useMemo","store","coreStore","editorStore","useEditedPostContext","select","getCurrentPostId","getCurrentPostType","postId","postType","useAllowSwitchingTemplates","canUser","getEntityRecord","getEntityRecords","siteSettings","kind","name","undefined","templates","per_page","isPostsPage","page_for_posts","isFrontPage","page_on_front","some","slug","useTemplates","post_type","useAvailableTemplates","currentTemplateSlug","useCurrentTemplateSlug","allowSwitchingTemplate","filter","template","is_custom","content","raw","entityTemplate","post","getEditedEntityRecord","find"],"sources":["@wordpress/editor/src/components/post-template/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useEditedPostContext() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n}\nexport function useAllowSwitchingTemplates() {\n\tconst { postType, postId } = useEditedPostContext();\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\tconst isPostsPage = +postId === siteSettings?.page_for_posts;\n\t\t\t// If current page is set front page or posts page, we also need\n\t\t\t// to check if the current theme has a template for it. If not\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' &&\n\t\t\t\t+postId === siteSettings?.page_on_front &&\n\t\t\t\ttemplates?.some( ( { slug } ) => slug === 'front-page' );\n\t\t\treturn ! isPostsPage && ! isFrontPage;\n\t\t},\n\t\t[ postId, postType ]\n\t);\n}\n\nfunction useTemplates( postType ) {\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t\tpost_type: postType,\n\t\t\t} ),\n\t\t[ postType ]\n\t);\n}\n\nexport function useAvailableTemplates( postType ) {\n\tconst currentTemplateSlug = useCurrentTemplateSlug();\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst templates = useTemplates( postType );\n\treturn useMemo(\n\t\t() =>\n\t\t\tallowSwitchingTemplate &&\n\t\t\ttemplates?.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\ttemplate.is_custom &&\n\t\t\t\t\ttemplate.slug !== currentTemplateSlug &&\n\t\t\t\t\t!! template.content.raw // Skip empty templates.\n\t\t\t),\n\t\t[ templates, currentTemplateSlug, allowSwitchingTemplate ]\n\t);\n}\n\nexport function useCurrentTemplateSlug() {\n\tconst { postType, postId } = useEditedPostContext();\n\tconst templates = useTemplates( postType );\n\tconst entityTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\treturn post?.template;\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tif ( ! entityTemplate ) {\n\t\treturn;\n\t}\n\t// If a page has a `template` set and is not included in the list\n\t// of the theme's templates, do not return it, in order to resolve\n\t// to the current theme's default template.\n\treturn templates?.find( ( template ) => template.slug === entityTemplate )\n\t\t?.slug;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAElD,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,OAAOL,SAAS,CAAIM,MAAM,IAAM;IAC/B,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEF,WAAY,CAAC;IACtE,OAAO;MACNK,MAAM,EAAEF,gBAAgB,CAAC,CAAC;MAC1BG,QAAQ,EAAEF,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;AACA,OA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MAAMC,sBAAsB,GAAGrB,0BAA0B,CAAC,CAAC;EAC3D,MAAMQ,SAAS,GAAGQ,YAAY,CAAEjB,QAAS,CAAC;EAC1C,OAAOT,OAAO,CACb,MACC+B,sBAAsB,IACtBb,SAAS,EAAEc,MAAM,CACdC,QAAQ,IACTA,QAAQ,CAACC,SAAS,IAClBD,QAAQ,CAACR,IAAI,KAAKI,mBAAmB,IACrC,CAAC,CAAEI,QAAQ,CAACE,OAAO,CAACC,GAAG,CAAC;EAC1B,CAAC,EACF,CAAElB,SAAS,EAAEW,mBAAmB,EAAEE,sBAAsB,CACzD,CAAC;AACF;AAEA,OAAO,SAASD,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAErB,QAAQ;IAAED;EAAO,CAAC,GAAGJ,oBAAoB,CAAC,CAAC;EACnD,MAAMc,SAAS,GAAGQ,YAAY,CAAEjB,QAAS,CAAC;EAC1C,MAAM4B,cAAc,GAAGtC,SAAS,CAC7BM,MAAM,IAAM;IACb,MAAMiC,IAAI,GAAGjC,MAAM,CAAEH,SAAU,CAAC,CAACqC,qBAAqB,CACrD,UAAU,EACV9B,QAAQ,EACRD,MACD,CAAC;IACD,OAAO8B,IAAI,EAAEL,QAAQ;EACtB,CAAC,EACD,CAAExB,QAAQ,EAAED,MAAM,CACnB,CAAC;EAED,IAAK,CAAE6B,cAAc,EAAG;IACvB;EACD;EACA;EACA;EACA;EACA,OAAOnB,SAAS,EAAEsB,IAAI,CAAIP,QAAQ,IAAMA,QAAQ,CAACR,IAAI,KAAKY,cAAe,CAAC,EACvEZ,IAAI;AACR","ignoreList":[]}
@@ -48,12 +48,18 @@ export default function PostTemplatePanel() {
48
48
  if (!settings.supportsTemplateMode) {
49
49
  return false;
50
50
  }
51
- const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
51
+ const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', {
52
+ kind: 'postType',
53
+ name: 'wp_template'
54
+ })) !== null && _select$canUser !== void 0 ? _select$canUser : false;
52
55
  return canCreateTemplates;
53
56
  }, []);
54
57
  const canViewTemplates = useSelect(select => {
55
58
  var _select$canUser2;
56
- return (_select$canUser2 = select(coreStore).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
59
+ return (_select$canUser2 = select(coreStore).canUser('read', {
60
+ kind: 'postType',
61
+ name: 'wp_template'
62
+ })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
57
63
  }, []);
58
64
  if ((!isBlockTheme || !canViewTemplates) && isVisible) {
59
65
  return /*#__PURE__*/_jsx(PostPanelRow, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","canViewTemplates","_select$canUser2","label","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {JSX.Element|null} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn select( coreStore ).canUser( 'read', 'templates' ) ?? false;\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<BlockThemeControl id={ templateId } />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,OAAOC,mBAAmB,MAAM,iBAAiB;AACjD,OAAOC,iBAAiB,MAAM,eAAe;AAC7C,OAAOC,YAAY,MAAM,mBAAmB;;AAE5C;AACA;AACA;A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,CAAC;EAEP,MAAME,gBAAgB,GAAGjC,SAAS,CAAIa,MAAM,IAAM;IAAA,IAAAqB,gBAAA;IACjD,QAAAA,gBAAA,GAAOrB,MAAM,CAAEV,SAAU,CAAC,CAAC6B,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EACnE,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAEtB,YAAY,IAAI,CAAEqB,gBAAgB,KAAMhB,SAAS,EAAG;IAC5D,oBACCR,IAAA,CAACF,YAAY;MAAC4B,KAAK,EAAGlC,EAAE,CAAE,UAAW,CAAG;MAAAmC,QAAA,eACvC3B,IAAA,CAACJ,mBAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAKO,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACCF,IAAA,CAACF,YAAY;MAAC4B,KAAK,EAAGlC,EAAE,CAAE,UAAW,CAAG;MAAAmC,QAAA,eACvC3B,IAAA,CAACH,iBAAiB;QAAC+B,EAAE,EAAG1B;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","label","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {JSX.Element|null} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! template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AAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -29,14 +29,16 @@ export default function PostTrashCheck({
29
29
  getCurrentPostType
30
30
  } = select(editorStore);
31
31
  const {
32
- getPostType,
33
32
  canUser
34
33
  } = select(coreStore);
35
- const postType = getPostType(getCurrentPostType());
34
+ const postType = getCurrentPostType();
36
35
  const postId = getCurrentPostId();
37
36
  const isNew = isEditedPostNew();
38
- const resource = postType?.rest_base || ''; // eslint-disable-line camelcase
39
- const canUserDelete = postId && resource ? canUser('delete', resource, postId) : false;
37
+ const canUserDelete = !!postId ? canUser('delete', {
38
+ kind: 'postType',
39
+ name: postType,
40
+ id: postId
41
+ }) : false;
40
42
  return {
41
43
  canTrashPost: (!isNew || postId) && canUserDelete
42
44
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","editorStore","PostTrashCheck","children","canTrashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","getPostType","canUser","postType","postId","isNew","resource","rest_base","canUserDelete"],"sources":["@wordpress/editor/src/components/post-trash/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post can trashed.\n *\n * @param {Object} props - The component props.\n * @param {Element} props.children - The child components to render.\n *\n * @return {Component|null} The rendered child components or null if the post can not trashed.\n */\nexport default function PostTrashCheck( { children } ) {\n\tconst { canTrashPost } = useSelect( ( select ) => {\n\t\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getPostType, canUser } = select( coreStore );\n\t\tconst postType = getPostType( getCurrentPostType() );\n\t\tconst postId = getCurrentPostId();\n\t\tconst isNew = isEditedPostNew();\n\t\tconst resource = postType?.rest_base || ''; // eslint-disable-line camelcase\n\t\tconst canUserDelete =\n\t\t\tpostId && resource ? canUser( 'delete', resource, postId ) : false;\n\n\t\treturn {\n\t\t\tcanTrashPost: ( ! isNew || postId ) && canUserDelete,\n\t\t};\n\t}, [] );\n\n\tif ( ! canTrashPost ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEJ,WAAY,CAAC;IACtB,MAAM;MAAEQ,WAAW;MAAEC;IAAQ,CAAC,GAAGL,MAAM,CAAEL,SAAU,CAAC;IACpD,MAAMW,QAAQ,GAAGF,WAAW,CAAED,kBAAkB,CAAC,CAAE,CAAC;IACpD,MAAMI,MAAM,GAAGL,gBAAgB,CAAC,CAAC;IACjC,MAAMM,KAAK,GAAGP,eAAe,CAAC,CAAC;IAC/B,MAAMQ,QAAQ,GAAGH,QAAQ,EAAEI,SAAS,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAMC,aAAa,GAClBJ,MAAM,IAAIE,QAAQ,GAAGJ,OAAO,CAAE,QAAQ,EAAEI,QAAQ,EAAEF,MAAO,CAAC,GAAG,KAAK;IAEnE,OAAO;MACNR,YAAY,EAAE,CAAE,CAAES,KAAK,IAAID,MAAM,KAAMI;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","editorStore","PostTrashCheck","children","canTrashPost","select","isEditedPostNew","getCurrentPostId","getCurrentPostType","canUser","postType","postId","isNew","canUserDelete","kind","name","id"],"sources":["@wordpress/editor/src/components/post-trash/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Wrapper component that renders its children only if the post can trashed.\n *\n * @param {Object} props - The component props.\n * @param {Element} props.children - The child components to render.\n *\n * @return {Component|null} The rendered child components or null if the post can not trashed.\n */\nexport default function PostTrashCheck( { children } ) {\n\tconst { canTrashPost } = useSelect( ( select ) => {\n\t\tconst { isEditedPostNew, getCurrentPostId, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst postType = getCurrentPostType();\n\t\tconst postId = getCurrentPostId();\n\t\tconst isNew = isEditedPostNew();\n\t\tconst canUserDelete = !! postId\n\t\t\t? canUser( 'delete', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t\tid: postId,\n\t\t\t } )\n\t\t\t: false;\n\n\t\treturn {\n\t\t\tcanTrashPost: ( ! isNew || postId ) && canUserDelete,\n\t\t};\n\t}, [] );\n\n\tif ( ! canTrashPost ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACtD,MAAM;IAAEC;EAAa,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACjD,MAAM;MAAEC,eAAe;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAC9DH,MAAM,CAAEJ,WAAY,CAAC;IACtB,MAAM;MAAEQ;IAAQ,CAAC,GAAGJ,MAAM,CAAEL,SAAU,CAAC;IACvC,MAAMU,QAAQ,GAAGF,kBAAkB,CAAC,CAAC;IACrC,MAAMG,MAAM,GAAGJ,gBAAgB,CAAC,CAAC;IACjC,MAAMK,KAAK,GAAGN,eAAe,CAAC,CAAC;IAC/B,MAAMO,aAAa,GAAG,CAAC,CAAEF,MAAM,GAC5BF,OAAO,CAAE,QAAQ,EAAE;MACnBK,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAEL,QAAQ;MACdM,EAAE,EAAEL;IACJ,CAAE,CAAC,GACH,KAAK;IAER,OAAO;MACNP,YAAY,EAAE,CAAE,CAAEQ,KAAK,IAAID,MAAM,KAAME;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAET,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
@@ -76,9 +76,13 @@ function PostURLToggle({
76
76
  getCurrentPost
77
77
  } = select(editorStore);
78
78
  const {
79
- getEditedEntityRecord
79
+ getEditedEntityRecord,
80
+ canUser
80
81
  } = select(coreStore);
81
- const siteSettings = getEditedEntityRecord('root', 'site');
82
+ const siteSettings = canUser('read', {
83
+ kind: 'root',
84
+ name: 'site'
85
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
82
86
  const _id = getCurrentPostId();
83
87
  return {
84
88
  slug: select(editorStore).getEditedPostSlug(),
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","useSelect","Dropdown","Button","__","sprintf","safeDecodeURIComponent","store","coreStore","PostURLCheck","PostURL","PostPanelRow","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","select","getCurrentPostId","getCurrentPost","getEditedEntityRecord","siteSettings","_id","getEditedPostSlug","page_on_front","link","decodedSlug","size","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ isFrontPage ? postLink : <>/{ decodedSlug }</> }\n\t\t</Button>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,YAAY,MAAM,SAAS;AAClC,OAAOC,OAAO,MAAM,SAAS;AAC7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;IAAEC;EAAS,CAAC,GAAGzC,SAAS,CAAI0C,MAAM,IAAM;IAChE,MAAM;MAAEC,gBAAgB;MAAEC;IAAe,CAAC,GAAGF,MAAM,CAAE/B,WAAY,CAAC;IAClE,MAAM;MAAEkC;IAAsB,CAAC,GAAGH,MAAM,CAAEnC,SAAU,CAAC;IACrD,MAAMuC,YAAY,GAAGD,qBAAqB,CAAE,MAAM,EAAE,MAAO,CAAC;IAC5D,MAAME,GAAG,GAAGJ,gBAAgB,CAAC,CAAC;IAC9B,OAAO;MACNJ,IAAI,EAAEG,MAAM,CAAE/B,WAAY,CAAC,CAACqC,iBAAiB,CAAC,CAAC;MAC/CR,WAAW,EAAEM,YAAY,EAAEG,aAAa,KAAKF,GAAG;MAChDN,QAAQ,EAAEG,cAAc,CAAC,CAAC,EAAEM;IAC7B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,WAAW,GAAG9C,sBAAsB,CAAEkC,IAAK,CAAC;EAClD,oBACC1B,IAAA,CAACX,MAAM;IACNkD,IAAI,EAAC,SAAS;IACdvB,SAAS,EAAC,+BAA+B;IACzCwB,OAAO,EAAC,UAAU;IAClB,iBAAgBpB;IAChB;IAAA;IACA,cAAa7B,OAAO,CAAED,EAAE,CAAE,iBAAkB,CAAC,EAAEgD,WAAY,CAAG;IAC9Df,OAAO,EAAGA,OAAS;IAAAV,QAAA,EAEjBc,WAAW,GAAGC,QAAQ,gBAAGxB,KAAA,CAAAF,SAAA;MAAAW,QAAA,GAAE,GAAC,EAAEyB,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useState","useSelect","Dropdown","Button","__","sprintf","safeDecodeURIComponent","store","coreStore","PostURLCheck","PostURL","PostPanelRow","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","select","getCurrentPostId","getCurrentPost","getEditedEntityRecord","canUser","siteSettings","kind","name","undefined","_id","getEditedPostSlug","page_on_front","link","decodedSlug","size","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' ), 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":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,sBAAsB,QAAQ,gBAAgB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEz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PerPage() {
31
31
  getCurrentPostType
32
32
  } = select(editorStore);
33
33
  const {
34
- getEditedEntityRecord
34
+ getEditedEntityRecord,
35
+ canUser
35
36
  } = select(coreStore);
36
- const siteSettings = getEditedEntityRecord('root', 'site');
37
+ const siteSettings = canUser('read', {
38
+ kind: 'root',
39
+ name: 'site'
40
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
37
41
  return {
38
42
  isTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,
39
43
  postSlug: getEditedPostAttribute('slug'),
@@ -1 +1 @@
1
- {"version":3,"names":["__","useSelect","useDispatch","store","coreStore","Button","Dropdown","__experimentalNumberControl","NumberControl","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","TEMPLATE_POST_TYPE","editorStore","PostPanelRow","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostsPerPage","editEntityRecord","postsPerPage","isTemplate","postSlug","select","getEditedPostAttribute","getCurrentPostType","getEditedEntityRecord","siteSettings","posts_per_page","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","includes","setPostsPerPage","newValue","undefined","label","ref","children","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","onClick","renderContent","onClose","title","placeholder","value","spinControls","step","min","onChange","help","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/posts-per-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tButton,\n\tDropdown,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostsPerPage() {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postsPerPage, isTemplate, postSlug } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEditedEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tisTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostsPerPage: siteSettings?.posts_per_page || 1,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isTemplate || ! [ 'home', 'index' ].includes( postSlug ) ) {\n\t\treturn null;\n\t}\n\tconst setPostsPerPage = ( newValue ) => {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tposts_per_page: newValue,\n\t\t} );\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Posts per page' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tcontentClassName=\"editor-posts-per-page-dropdown__content\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\taria-label={ __( 'Change posts per page' ) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ postsPerPage }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tplaceholder={ 0 }\n\t\t\t\t\t\t\tvalue={ postsPerPage }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tspinControls=\"custom\"\n\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tonChange={ setPostsPerPage }\n\t\t\t\t\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,MAAM,EACNC,QAAQ,EACRC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASV,KAAK,IAAIW,WAAW,QAAQ,aAAa;AAClD,OAAOC,YAA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MAAM,EAAEoB,SAAS,EAAE;MAC5CX,cAAc,EAAEU;IACjB,CAAE,CAAC;EACJ,CAAC;EACD,oBACCzB,IAAA,CAACF,YAAY;IAAC6B,KAAK,EAAG5C,EAAE,CAAE,gBAAiB,CAAG;IAAC6C,GAAG,EAAGX,gBAAkB;IAAAY,QAAA,eACtE7B,IAAA,CAACX,QAAQ;MACR6B,YAAY,EAAGA,YAAc;MAC7BY,gBAAgB,EAAC,yCAAyC;MAC1DC,YAAY;MACZC,YAAY,EAAGA,CAAE;QAAEC,MAAM;QAAEC;MAAS,CAAC,kBACpClC,IAAA,CAACZ,MAAM;QACN+C,IAAI,EAAC,SAAS;QACdC,OAAO,EAAC,UAAU;QAClB,iBAAgBH,MAAQ;QACxB,cAAalD,EAAE,CAAE,uBAAwB,CAAG;QAC5CsD,OAAO,EAAGH,QAAU;QAAAL,QAAA,EAElBtB;MAAY,CACP,CACN;MACH+B,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BnC,KAAA,CAAAF,SAAA;QAAA2B,QAAA,gBACC7B,IAAA,CAACL,sBAAsB;UACtB6C,KAAK,EAAGzD,EAAE,CAAE,gBAAiB,CAAG;UAChCwD,OAAO,EAAGA;QAAS,CACnB,CAAC,eACFvC,IAAA,CAACT,aAAa;UACbkD,WAAW,EAAG,CAAG;UACjBC,KAAK,EAAGnC,YAAc;UACtB4B,IAAI,EAAC,kBAAkB;UACvBQ,YAAY,EAAC,QAAQ;UACrBC,IAAI,EAAC,GAAG;UACRC,GAAG,EAAC,GAAG;UACPC,QAAQ,EAAGtB,eAAiB;UAC5BG,KAAK,EAAG5C,EAAE,CAAE,gBAAiB,CAAG;UAChCgE,IAAI,EAAGhE,EAAE,CACR,oIACD,CAAG;UACHiE,mBAAmB;QAAA,CACnB,CAAC;MAAA,CACD;IACA,CACH;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["__","useSelect","useDispatch","store","coreStore","Button","Dropdown","__experimentalNumberControl","NumberControl","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","TEMPLATE_POST_TYPE","editorStore","PostPanelRow","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PostsPerPage","editEntityRecord","postsPerPage","isTemplate","postSlug","select","getEditedPostAttribute","getCurrentPostType","getEditedEntityRecord","canUser","siteSettings","kind","name","undefined","posts_per_page","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","includes","setPostsPerPage","newValue","label","ref","children","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","onClick","renderContent","onClose","title","placeholder","value","spinControls","step","min","onChange","help","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/posts-per-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tButton,\n\tDropdown,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostsPerPage() {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postsPerPage, isTemplate, postSlug } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\treturn {\n\t\t\tisTemplate: getCurrentPostType() === TEMPLATE_POST_TYPE,\n\t\t\tpostSlug: getEditedPostAttribute( 'slug' ),\n\t\t\tpostsPerPage: siteSettings?.posts_per_page || 1,\n\t\t};\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isTemplate || ! [ 'home', 'index' ].includes( postSlug ) ) {\n\t\treturn null;\n\t}\n\tconst setPostsPerPage = ( newValue ) => {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tposts_per_page: newValue,\n\t\t} );\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Posts per page' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tcontentClassName=\"editor-posts-per-page-dropdown__content\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\taria-label={ __( 'Change posts per page' ) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ postsPerPage }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tplaceholder={ 0 }\n\t\t\t\t\t\t\tvalue={ postsPerPage }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tspinControls=\"custom\"\n\t\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tonChange={ setPostsPerPage }\n\t\t\t\t\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,MAAM,EACNC,QAAQ,EACRC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASV,KAAK,IAAIW,WAAW,QAAQ,aAAa;AAClD,OAAOC,YAAY,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE7C,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC,MAAM;IAAEC;EAAiB,CAAC,GAAGrB,WAAW,CAAEE,SAAU,CAAC;EACrD,MAAM;IAAEoB,YAAY;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGzB,SAAS,CAAI0B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AGV,gBAAkB;IAAAW,QAAA,eACtEhC,IAAA,CAACX,QAAQ;MACRiC,YAAY,EAAGA,YAAc;MAC7BW,gBAAgB,EAAC,yCAAyC;MAC1DC,YAAY;MACZC,YAAY,EAAGA,CAAE;QAAEC,MAAM;QAAEC;MAAS,CAAC,kBACpCrC,IAAA,CAACZ,MAAM;QACNkD,IAAI,EAAC,SAAS;QACdC,OAAO,EAAC,UAAU;QAClB,iBAAgBH,MAAQ;QACxB,cAAarD,EAAE,CAAE,uBAAwB,CAAG;QAC5CyD,OAAO,EAAGH,QAAU;QAAAL,QAAA,EAElBzB;MAAY,CACP,CACN;MACHkC,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BtC,KAAA,CAAAF,SAAA;QAAA8B,QAAA,gBACChC,IAAA,CAACL,sBAAsB;UACtBgD,KAAK,EAAG5D,EAAE,CAAE,gBAAiB,CAAG;UAChC2D,OAAO,EAAGA;QAAS,CACnB,CAAC,eACF1C,IAAA,CAACT,aAAa;UACbqD,WAAW,EAAG,CAAG;UACjBC,KAAK,EAAGtC,YAAc;UACtB+B,IAAI,EAAC,kBAAkB;UACvBQ,YAAY,EAAC,QAAQ;UACrBC,IAAI,EAAC,GAAG;UACRC,GAAG,EAAC,GAAG;UACPC,QAAQ,EAAGrB,eAAiB;UAC5BE,KAAK,EAAG/C,EAAE,CAAE,gBAAiB,CAAG;UAChCmE,IAAI,EAAGnE,EAAE,CACR,oIACD,CAAG;UACHoE,mBAAmB;QAAA,CACnB,CAAC;MAAA,CACD;IACA,CACH;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
@@ -26,7 +26,7 @@ function __experimentalReusableBlocksSelect(select) {
26
26
  per_page: -1
27
27
  })) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : EMPTY_BLOCKS_LIST;
28
28
  }
29
- const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'sectionRootClientId', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
29
+ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'sectionRootClientId', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme'];
30
30
  const {
31
31
  globalStylesDataKey,
32
32
  globalStylesLinksDataKey,
@@ -82,7 +82,10 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
82
82
  getBlocksByName,
83
83
  getBlockAttributes
84
84
  } = select(blockEditorStore);
85
- const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
85
+ const siteSettings = canUser('read', {
86
+ kind: 'root',
87
+ name: 'site'
88
+ }) ? getEntityRecord('root', 'site') : undefined;
86
89
  function getSectionRootBlock() {
87
90
  var _getBlocksByName$find;
88
91
  if (renderingMode === 'template-locked') {
@@ -100,8 +103,14 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
100
103
  hiddenBlockTypes: get('core', 'hiddenBlockTypes'),
101
104
  isDistractionFree: get('core', 'distractionFree'),
102
105
  keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'),
103
- hasUploadPermissions: (_canUser = canUser('create', 'media')) !== null && _canUser !== void 0 ? _canUser : true,
104
- userCanCreatePages: canUser('create', 'pages'),
106
+ hasUploadPermissions: (_canUser = canUser('create', {
107
+ kind: 'root',
108
+ name: 'media'
109
+ })) !== null && _canUser !== void 0 ? _canUser : true,
110
+ userCanCreatePages: canUser('create', {
111
+ kind: 'postType',
112
+ name: 'page'
113
+ }),
105
114
  pageOnFront: siteSettings?.page_on_front,
106
115
  pageForPosts: siteSettings?.page_for_posts,
107
116
  userPatternCategories: getUserPatternCategories(),
@@ -198,7 +207,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
198
207
  __experimentalUndo: undo,
199
208
  // Check whether we want all site editor frames to have outlines
200
209
  // including the navigation / pattern / parts editors.
201
- outlineMode: postType === 'wp_template',
210
+ outlineMode: !isDistractionFree && postType === 'wp_template',
202
211
  // Check these two properties: they were not present in the site editor.
203
212
  __experimentalCreatePageEntity: createPageEntity,
204
213
  __experimentalUserCanCreatePages: userCanCreatePages,
@@ -213,7 +222,7 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
213
222
  sectionRootClientId
214
223
  });
215
224
  return blockEditorSettings;
216
- }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData]);
225
+ }, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData]);
217
226
  }
218
227
  export default useBlockEditorSettings;
219
228
  //# sourceMappingURL=use-block-editor-settings.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","preferencesStore","useViewportMatch","blocksStore","privateApis","blockEditorStore","inserterMediaCategories","mediaUpload","editorStore","lock","unlock","useGlobalStylesContext","EMPTY_BLOCKS_LIST","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","_select$getEntityReco","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","name","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\nimport { lock, unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_BLOCKS_LIST = [];\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\treturn (\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} ) ?? EMPTY_BLOCKS_LIST\n\t);\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'sectionRootClientId',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n\t'__experimentalArchiveTitleTypeLabel',\n\t'__experimentalArchiveTitleNameLabel',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t\tlock( blockEditorSettings, {\n\t\t\tsectionRootClientId,\n\t\t} );\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;A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G,gBAAgB,EAChBvD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,EACZnB,QAAQ,EACRsE,mBAAmB,EACnBhD,mBAAmB,EACnByB,gBAAgB,CACf,CAAC;AACJ;AAEA,eAAejD,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","preferencesStore","useViewportMatch","blocksStore","privateApis","blockEditorStore","inserterMediaCategories","mediaUpload","editorStore","lock","unlock","useGlobalStylesContext","EMPTY_BLOCKS_LIST","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","_select$getEntityReco","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","kind","name","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\nimport { lock, unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_BLOCKS_LIST = [];\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\treturn (\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} ) ?? EMPTY_BLOCKS_LIST\n\t);\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'sectionRootClientId',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\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\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t\tlock( blockEditorSettings, {\n\t\t\tsectionRootClientId,\n\t\t} );\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,QACpC,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC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,gBAAgB,EAChBE,qBAAqB,CACpB,CAAC;AACJ;AAEA,eAAerD,sBAAsB","ignoreList":[]}
@@ -14,7 +14,6 @@ import PostPublishPanel from '../post-publish-panel';
14
14
  import PluginPrePublishPanel from '../plugin-pre-publish-panel';
15
15
  import PluginPostPublishPanel from '../plugin-post-publish-panel';
16
16
  import { store as editorStore } from '../../store';
17
- import { unlock } from '../../lock-unlock';
18
17
  import { jsx as _jsx } from "react/jsx-runtime";
19
18
  import { Fragment as _Fragment } from "react/jsx-runtime";
20
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -46,7 +45,7 @@ export default function SavePublishPanels({
46
45
  isEditedPostDirty,
47
46
  hasNonPostEntityChanges
48
47
  } = select(editorStore);
49
- const _hasOtherEntitiesChanges = hasNonPostEntityChanges() || unlock(select(editorStore)).hasPostMetaChanges();
48
+ const _hasOtherEntitiesChanges = hasNonPostEntityChanges();
50
49
  return {
51
50
  publishSidebarOpened: isPublishSidebarOpened(),
52
51
  isPublishable: !isCurrentPostPublished() && isEditedPostPublishable(),
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","isPublishable","isDirty","hasOtherEntitiesChanges","select","isPublishSidebarOpened","isEditedPostPublishable","isCurrentPostPublished","isEditedPostDirty","hasNonPostEntityChanges","_hasOtherEntitiesChanges","hasPostMetaChanges","openEntitiesSavedStates","unmountableContent","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","children","variant","onClick","disabled","accessibleWhenDisabled","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\tisPublishable,\n\t\tisDirty,\n\t\thasOtherEntitiesChanges,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPublishSidebarOpened,\n\t\t\tisEditedPostPublishable,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostDirty,\n\t\t\thasNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _hasOtherEntitiesChanges =\n\t\t\thasNonPostEntityChanges() ||\n\t\t\tunlock( select( editorStore ) ).hasPostMetaChanges();\n\t\treturn {\n\t\t\tpublishSidebarOpened: isPublishSidebarOpened(),\n\t\t\tisPublishable:\n\t\t\t\t! isCurrentPostPublished() && isEditedPostPublishable(),\n\t\t\tisDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),\n\t\t\thasOtherEntitiesChanges: _hasOtherEntitiesChanges,\n\t\t};\n\t}, [] );\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( isPublishable && ! hasOtherEntitiesChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen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AAJ,QAAA,EAEpB5C,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CACL;EACF;;EAEA;EACA;EACA,oBACCc,KAAA,CAAAF,SAAA;IAAAgC,QAAA,GACGvB,yBAAyB,iBAC1BX,IAAA,CAACR,mBAAmB;MAAC+C,KAAK,EAAG7B;IAA0B,CAAE,CACzD,eACDV,IAAA,CAACM,IAAI;MAACkC,gBAAgB;IAAA,CAAE,CAAC,EACvB,CAAE7B,yBAAyB,IAAIiB,kBAAkB;EAAA,CAClD,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","isPublishable","isDirty","hasOtherEntitiesChanges","select","isPublishSidebarOpened","isEditedPostPublishable","isCurrentPostPublished","isEditedPostDirty","hasNonPostEntityChanges","_hasOtherEntitiesChanges","openEntitiesSavedStates","unmountableContent","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","children","variant","onClick","disabled","accessibleWhenDisabled","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\tisPublishable,\n\t\tisDirty,\n\t\thasOtherEntitiesChanges,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPublishSidebarOpened,\n\t\t\tisEditedPostPublishable,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostDirty,\n\t\t\thasNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _hasOtherEntitiesChanges = hasNonPostEntityChanges();\n\t\treturn {\n\t\t\tpublishSidebarOpened: isPublishSidebarOpened(),\n\t\t\tisPublishable:\n\t\t\t\t! isCurrentPostPublished() && isEditedPostPublishable(),\n\t\t\tisDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),\n\t\t\thasOtherEntitiesChanges: _hasOtherEntitiesChanges,\n\t\t};\n\t}, [] );\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( isPublishable && ! hasOtherEntitiesChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen && unmountableContent }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,SAASC,KAAK,IAAIC,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ACzCkB,mBAAmB,EAAGnC,qBAAqB,CAACW,IAAM;MAClDyB,oBAAoB,EAAGnC,sBAAsB,CAACU;IAAM,CACpD,CACD;EACF,CAAC,MAAM,IAAKU,aAAa,IAAI,CAAEE,uBAAuB,EAAG;IACxDS,kBAAkB,gBACjB3B,IAAA;MAAKgC,SAAS,EAAC,qCAAqC;MAAAC,QAAA,eACnDjC,IAAA,CAACX,MAAM;QACN6C,OAAO,EAAC,WAAW;QACnBF,SAAS,EAAC,4CAA4C;QACtDG,OAAO,EAAGrB,oBAAsB;QAChC,iBAAgB,KAAO;QAAAmB,QAAA,EAErB1C,EAAE,CAAE,oBAAqB;MAAC,CACrB;IAAC,CACL,CACL;EACF,CAAC,MAAM;IACNoC,kBAAkB,gBACjB3B,IAAA;MAAKgC,SAAS,EAAC,mDAAmD;MAAAC,QAAA,eACjEjC,IAAA,CAACX,MAAM;QACN6C,OAAO,EAAC,WAAW;QACnBF,SAAS,EAAC,0DAA0D;QACpEG,OAAO,EAAGT,uBAAyB;QACnC,iBAAgB,KAAO;QACvBU,QAAQ,EAAG,CAAEnB,OAAS;QACtBoB,sBAAsB;QAAAJ,QAAA,EAEpB1C,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CACL;EACF;;EAEA;EACA;EACA,oBACCa,KAAA,CAAAF,SAAA;IAAA+B,QAAA,GACGtB,yBAAyB,iBAC1BX,IAAA,CAACP,mBAAmB;MAAC6C,KAAK,EAAG5B;IAA0B,CAAE,CACzD,eACDV,IAAA,CAACM,IAAI;MAACiC,gBAAgB;IAAA,CAAE,CAAC,EACvB,CAAE5B,yBAAyB,IAAIgB,kBAAkB;EAAA,CAClD,CAAC;AAEL","ignoreList":[]}
@@ -39,7 +39,6 @@ const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select({
39
39
  const SidebarContent = ({
40
40
  tabName,
41
41
  keyboardShortcut,
42
- renderingMode,
43
42
  onActionPerformed,
44
43
  extraPanels
45
44
  }) => {
@@ -95,9 +94,7 @@ const SidebarContent = ({
95
94
  focusable: false,
96
95
  children: [/*#__PURE__*/_jsx(PostSummary, {
97
96
  onActionPerformed: onActionPerformed
98
- }), /*#__PURE__*/_jsx(PluginDocumentSettingPanel.Slot, {}), /*#__PURE__*/_jsx(TemplateContentPanel, {
99
- renderingMode: renderingMode
100
- }), /*#__PURE__*/_jsx(TemplatePartContentPanel, {}), /*#__PURE__*/_jsx(PostTransformPanel, {}), /*#__PURE__*/_jsx(PostTaxonomiesPanel, {}), /*#__PURE__*/_jsx(PatternOverridesPanel, {}), extraPanels]
97
+ }), /*#__PURE__*/_jsx(PluginDocumentSettingPanel.Slot, {}), /*#__PURE__*/_jsx(TemplateContentPanel, {}), /*#__PURE__*/_jsx(TemplatePartContentPanel, {}), /*#__PURE__*/_jsx(PostTransformPanel, {}), /*#__PURE__*/_jsx(PostTaxonomiesPanel, {}), /*#__PURE__*/_jsx(PatternOverridesPanel, {}), extraPanels]
101
98
  }), /*#__PURE__*/_jsx(Tabs.TabPanel, {
102
99
  tabId: sidebars.block,
103
100
  focusable: false,
@@ -114,8 +111,7 @@ const Sidebar = ({
114
111
  const {
115
112
  tabName,
116
113
  keyboardShortcut,
117
- showSummary,
118
- renderingMode
114
+ showSummary
119
115
  } = useSelect(select => {
120
116
  const shortcut = select(keyboardShortcutsStore).getShortcutRepresentation('core/editor/toggle-sidebar');
121
117
  const sidebar = select(interfaceStore).getActiveComplementaryArea('core');
@@ -127,8 +123,7 @@ const Sidebar = ({
127
123
  return {
128
124
  tabName: _tabName,
129
125
  keyboardShortcut: shortcut,
130
- showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(editorStore).getCurrentPostType()),
131
- renderingMode: select(editorStore).getRenderingMode()
126
+ showSummary: ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE].includes(select(editorStore).getCurrentPostType())
132
127
  };
133
128
  }, []);
134
129
  const {
@@ -147,7 +142,6 @@ const Sidebar = ({
147
142
  tabName: tabName,
148
143
  keyboardShortcut: keyboardShortcut,
149
144
  showSummary: showSummary,
150
- renderingMode: renderingMode,
151
145
  onActionPerformed: onActionPerformed,
152
146
  extraPanels: extraPanels
153
147
  })