@wordpress/editor 14.13.1-next.cd6172eb0.0 → 14.15.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 (478) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -0
  4. package/build/bindings/pattern-overrides.js +1 -0
  5. package/build/bindings/pattern-overrides.js.map +1 -1
  6. package/build/bindings/post-meta.js +1 -0
  7. package/build/bindings/post-meta.js.map +1 -1
  8. package/build/components/autocompleters/user.js +1 -0
  9. package/build/components/autocompleters/user.js.map +1 -1
  10. package/build/components/block-removal-warnings/index.js +1 -0
  11. package/build/components/block-removal-warnings/index.js.map +1 -1
  12. package/build/components/block-settings-menu/content-only-settings-menu.js +1 -0
  13. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  14. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
  15. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  16. package/build/components/collab-sidebar/add-comment.js +1 -1
  17. package/build/components/collab-sidebar/add-comment.js.map +1 -1
  18. package/build/components/collab-sidebar/comment-button.js +7 -2
  19. package/build/components/collab-sidebar/comment-button.js.map +1 -1
  20. package/build/components/collab-sidebar/comment-form.js +4 -1
  21. package/build/components/collab-sidebar/comment-form.js.map +1 -1
  22. package/build/components/collab-sidebar/comments.js +199 -185
  23. package/build/components/collab-sidebar/comments.js.map +1 -1
  24. package/build/components/collab-sidebar/index.js +11 -4
  25. package/build/components/collab-sidebar/index.js.map +1 -1
  26. package/build/components/collab-sidebar/utils.js +1 -0
  27. package/build/components/collab-sidebar/utils.js.map +1 -1
  28. package/build/components/commands/index.js +28 -0
  29. package/build/components/commands/index.js.map +1 -1
  30. package/build/components/deprecated.js +1 -0
  31. package/build/components/deprecated.js.map +1 -1
  32. package/build/components/document-bar/index.js +5 -2
  33. package/build/components/document-bar/index.js.map +1 -1
  34. package/build/components/document-outline/index.js +1 -0
  35. package/build/components/document-outline/index.js.map +1 -1
  36. package/build/components/document-tools/index.js +3 -6
  37. package/build/components/document-tools/index.js.map +1 -1
  38. package/build/components/editor-help/index.native.js +1 -0
  39. package/build/components/editor-help/index.native.js.map +1 -1
  40. package/build/components/editor-help/intro-to-blocks.native.js +1 -1
  41. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  42. package/build/components/editor-notices/index.js +1 -0
  43. package/build/components/editor-notices/index.js.map +1 -1
  44. package/build/components/editor-snackbars/index.js +1 -0
  45. package/build/components/editor-snackbars/index.js.map +1 -1
  46. package/build/components/entities-saved-states/entity-type-list.js +1 -0
  47. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  48. package/build/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
  49. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  50. package/build/components/entities-saved-states/index.js +3 -1
  51. package/build/components/entities-saved-states/index.js.map +1 -1
  52. package/build/components/error-boundary/index.js +26 -13
  53. package/build/components/error-boundary/index.js.map +1 -1
  54. package/build/components/error-boundary/index.native.js +1 -1
  55. package/build/components/error-boundary/index.native.js.map +1 -1
  56. package/build/components/keyboard-shortcut-help-modal/index.js +1 -0
  57. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  58. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
  59. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  60. package/build/components/list-view-sidebar/index.js +1 -0
  61. package/build/components/list-view-sidebar/index.js.map +1 -1
  62. package/build/components/local-autosave-monitor/index.js +1 -0
  63. package/build/components/local-autosave-monitor/index.js.map +1 -1
  64. package/build/components/mode-switcher/index.js +1 -0
  65. package/build/components/mode-switcher/index.js.map +1 -1
  66. package/build/components/more-menu/index.js +0 -1
  67. package/build/components/more-menu/index.js.map +1 -1
  68. package/build/components/page-attributes/parent.js +1 -0
  69. package/build/components/page-attributes/parent.js.map +1 -1
  70. package/build/components/post-actions/actions.js +10 -4
  71. package/build/components/post-actions/actions.js.map +1 -1
  72. package/build/components/post-actions/index.js +80 -91
  73. package/build/components/post-actions/index.js.map +1 -1
  74. package/build/components/post-actions/set-as-homepage.js +23 -34
  75. package/build/components/post-actions/set-as-homepage.js.map +1 -1
  76. package/build/components/post-actions/set-as-posts-page.js +154 -0
  77. package/build/components/post-actions/set-as-posts-page.js.map +1 -0
  78. package/build/components/post-author/hook.js +1 -0
  79. package/build/components/post-author/hook.js.map +1 -1
  80. package/build/components/post-card-panel/index.js +64 -24
  81. package/build/components/post-card-panel/index.js.map +1 -1
  82. package/build/components/post-fields/index.js +1 -0
  83. package/build/components/post-fields/index.js.map +1 -1
  84. package/build/components/post-format/index.js +1 -0
  85. package/build/components/post-format/index.js.map +1 -1
  86. package/build/components/post-format/panel.js +1 -0
  87. package/build/components/post-format/panel.js.map +1 -1
  88. package/build/components/post-publish-button/index.js +1 -0
  89. package/build/components/post-publish-button/index.js.map +1 -1
  90. package/build/components/post-publish-panel/maybe-category-panel.js +1 -0
  91. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  92. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -0
  93. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  94. package/build/components/post-publish-panel/maybe-upload-media.js +2 -1
  95. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  96. package/build/components/post-publish-panel/media-util.js +1 -0
  97. package/build/components/post-publish-panel/media-util.js.map +1 -1
  98. package/build/components/post-publish-panel/prepublish.js +1 -1
  99. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  100. package/build/components/post-saved-state/index.js +1 -0
  101. package/build/components/post-saved-state/index.js.map +1 -1
  102. package/build/components/post-schedule/index.js +1 -0
  103. package/build/components/post-schedule/index.js.map +1 -1
  104. package/build/components/post-taxonomies/flat-term-selector.js +1 -0
  105. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  106. package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  107. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  108. package/build/components/post-taxonomies/index.js +1 -0
  109. package/build/components/post-taxonomies/index.js.map +1 -1
  110. package/build/components/post-taxonomies/most-used-terms.js +1 -0
  111. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  112. package/build/components/post-template/classic-theme.js +1 -0
  113. package/build/components/post-template/classic-theme.js.map +1 -1
  114. package/build/components/post-template/swap-template-button.js +1 -0
  115. package/build/components/post-template/swap-template-button.js.map +1 -1
  116. package/build/components/post-transform-panel/hooks.js +1 -0
  117. package/build/components/post-transform-panel/hooks.js.map +1 -1
  118. package/build/components/post-type-support-check/index.js +1 -0
  119. package/build/components/post-type-support-check/index.js.map +1 -1
  120. package/build/components/preferences-modal/block-visibility.js +1 -0
  121. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  122. package/build/components/preferences-modal/index.js +3 -4
  123. package/build/components/preferences-modal/index.js.map +1 -1
  124. package/build/components/preview-dropdown/index.js +0 -1
  125. package/build/components/preview-dropdown/index.js.map +1 -1
  126. package/build/components/provider/disable-non-page-content-blocks.js +66 -13
  127. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  128. package/build/components/provider/index.js +9 -13
  129. package/build/components/provider/index.js.map +1 -1
  130. package/build/components/provider/index.native.js +1 -0
  131. package/build/components/provider/index.native.js.map +1 -1
  132. package/build/components/provider/use-block-editor-settings.js +4 -1
  133. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  134. package/build/components/sidebar/index.js +1 -0
  135. package/build/components/sidebar/index.js.map +1 -1
  136. package/build/components/start-page-options/index.js +20 -106
  137. package/build/components/start-page-options/index.js.map +1 -1
  138. package/build/components/start-template-options/index.js +1 -0
  139. package/build/components/start-template-options/index.js.map +1 -1
  140. package/build/components/template-part-content-panel/index.js +1 -0
  141. package/build/components/template-part-content-panel/index.js.map +1 -1
  142. package/build/components/template-part-menu-items/index.js +2 -10
  143. package/build/components/template-part-menu-items/index.js.map +1 -1
  144. package/build/components/theme-support-check/index.js +1 -0
  145. package/build/components/theme-support-check/index.js.map +1 -1
  146. package/build/components/visual-editor/use-select-nearest-editable-block.js +1 -0
  147. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  148. package/build/dataviews/store/private-actions.js +16 -2
  149. package/build/dataviews/store/private-actions.js.map +1 -1
  150. package/build/dataviews/store/reducer.js +1 -0
  151. package/build/dataviews/store/reducer.js.map +1 -1
  152. package/build/hooks/custom-sources-backwards-compatibility.js +1 -0
  153. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  154. package/build/hooks/pattern-overrides.js +1 -0
  155. package/build/hooks/pattern-overrides.js.map +1 -1
  156. package/build/store/actions.js +1 -2
  157. package/build/store/actions.js.map +1 -1
  158. package/build/store/constants.js +1 -3
  159. package/build/store/constants.js.map +1 -1
  160. package/build/store/private-actions.js +2 -1
  161. package/build/store/private-actions.js.map +1 -1
  162. package/build/store/private-selectors.js +1 -0
  163. package/build/store/private-selectors.js.map +1 -1
  164. package/build/store/reducer.js +1 -0
  165. package/build/store/reducer.js.map +1 -1
  166. package/build/store/reducer.native.js +1 -0
  167. package/build/store/reducer.native.js.map +1 -1
  168. package/build/store/selectors.js +1 -0
  169. package/build/store/selectors.js.map +1 -1
  170. package/build/store/utils/notice-builder.js +3 -8
  171. package/build/store/utils/notice-builder.js.map +1 -1
  172. package/build/utils/get-item-title.js +32 -0
  173. package/build/utils/get-item-title.js.map +1 -0
  174. package/build/utils/get-template-info.js +1 -0
  175. package/build/utils/get-template-info.js.map +1 -1
  176. package/build/utils/media-sideload/index.js +21 -0
  177. package/build/utils/media-sideload/index.js.map +1 -0
  178. package/build/utils/media-sideload/index.native.js +8 -0
  179. package/build/utils/media-sideload/index.native.js.map +1 -0
  180. package/build/utils/media-upload/index.js +5 -2
  181. package/build/utils/media-upload/index.js.map +1 -1
  182. package/build/utils/pageTypeBadge.js +6 -12
  183. package/build/utils/pageTypeBadge.js.map +1 -1
  184. package/build/utils/terms.js +1 -0
  185. package/build/utils/terms.js.map +1 -1
  186. package/build-module/bindings/pattern-overrides.js +1 -0
  187. package/build-module/bindings/pattern-overrides.js.map +1 -1
  188. package/build-module/bindings/post-meta.js +1 -0
  189. package/build-module/bindings/post-meta.js.map +1 -1
  190. package/build-module/components/autocompleters/user.js +1 -0
  191. package/build-module/components/autocompleters/user.js.map +1 -1
  192. package/build-module/components/block-removal-warnings/index.js +1 -0
  193. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  194. package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -0
  195. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  196. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
  197. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  198. package/build-module/components/collab-sidebar/add-comment.js +1 -1
  199. package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
  200. package/build-module/components/collab-sidebar/comment-button.js +7 -2
  201. package/build-module/components/collab-sidebar/comment-button.js.map +1 -1
  202. package/build-module/components/collab-sidebar/comment-form.js +4 -1
  203. package/build-module/components/collab-sidebar/comment-form.js.map +1 -1
  204. package/build-module/components/collab-sidebar/comments.js +201 -187
  205. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  206. package/build-module/components/collab-sidebar/index.js +11 -4
  207. package/build-module/components/collab-sidebar/index.js.map +1 -1
  208. package/build-module/components/collab-sidebar/utils.js +1 -0
  209. package/build-module/components/collab-sidebar/utils.js.map +1 -1
  210. package/build-module/components/commands/index.js +28 -0
  211. package/build-module/components/commands/index.js.map +1 -1
  212. package/build-module/components/deprecated.js +1 -0
  213. package/build-module/components/deprecated.js.map +1 -1
  214. package/build-module/components/document-bar/index.js +5 -2
  215. package/build-module/components/document-bar/index.js.map +1 -1
  216. package/build-module/components/document-outline/index.js +1 -0
  217. package/build-module/components/document-outline/index.js.map +1 -1
  218. package/build-module/components/document-tools/index.js +4 -7
  219. package/build-module/components/document-tools/index.js.map +1 -1
  220. package/build-module/components/editor-help/index.native.js +1 -0
  221. package/build-module/components/editor-help/index.native.js.map +1 -1
  222. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
  223. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  224. package/build-module/components/editor-notices/index.js +1 -0
  225. package/build-module/components/editor-notices/index.js.map +1 -1
  226. package/build-module/components/editor-snackbars/index.js +1 -0
  227. package/build-module/components/editor-snackbars/index.js.map +1 -1
  228. package/build-module/components/entities-saved-states/entity-type-list.js +1 -0
  229. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  230. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
  231. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  232. package/build-module/components/entities-saved-states/index.js +3 -1
  233. package/build-module/components/entities-saved-states/index.js.map +1 -1
  234. package/build-module/components/error-boundary/index.js +28 -15
  235. package/build-module/components/error-boundary/index.js.map +1 -1
  236. package/build-module/components/error-boundary/index.native.js +2 -2
  237. package/build-module/components/error-boundary/index.native.js.map +1 -1
  238. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -0
  239. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  240. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
  241. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  242. package/build-module/components/list-view-sidebar/index.js +1 -0
  243. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  244. package/build-module/components/local-autosave-monitor/index.js +1 -0
  245. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  246. package/build-module/components/mode-switcher/index.js +1 -0
  247. package/build-module/components/mode-switcher/index.js.map +1 -1
  248. package/build-module/components/more-menu/index.js +0 -1
  249. package/build-module/components/more-menu/index.js.map +1 -1
  250. package/build-module/components/page-attributes/parent.js +1 -0
  251. package/build-module/components/page-attributes/parent.js.map +1 -1
  252. package/build-module/components/post-actions/actions.js +10 -4
  253. package/build-module/components/post-actions/actions.js.map +1 -1
  254. package/build-module/components/post-actions/index.js +81 -93
  255. package/build-module/components/post-actions/index.js.map +1 -1
  256. package/build-module/components/post-actions/set-as-homepage.js +22 -33
  257. package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
  258. package/build-module/components/post-actions/set-as-posts-page.js +146 -0
  259. package/build-module/components/post-actions/set-as-posts-page.js.map +1 -0
  260. package/build-module/components/post-author/hook.js +1 -0
  261. package/build-module/components/post-author/hook.js.map +1 -1
  262. package/build-module/components/post-card-panel/index.js +66 -26
  263. package/build-module/components/post-card-panel/index.js.map +1 -1
  264. package/build-module/components/post-fields/index.js +1 -0
  265. package/build-module/components/post-fields/index.js.map +1 -1
  266. package/build-module/components/post-format/index.js +1 -0
  267. package/build-module/components/post-format/index.js.map +1 -1
  268. package/build-module/components/post-format/panel.js +1 -0
  269. package/build-module/components/post-format/panel.js.map +1 -1
  270. package/build-module/components/post-publish-button/index.js +1 -0
  271. package/build-module/components/post-publish-button/index.js.map +1 -1
  272. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -0
  273. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  274. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -0
  275. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  276. package/build-module/components/post-publish-panel/maybe-upload-media.js +3 -2
  277. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  278. package/build-module/components/post-publish-panel/media-util.js +1 -0
  279. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  280. package/build-module/components/post-publish-panel/prepublish.js +1 -1
  281. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  282. package/build-module/components/post-saved-state/index.js +1 -0
  283. package/build-module/components/post-saved-state/index.js.map +1 -1
  284. package/build-module/components/post-schedule/index.js +1 -0
  285. package/build-module/components/post-schedule/index.js.map +1 -1
  286. package/build-module/components/post-taxonomies/flat-term-selector.js +1 -0
  287. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  288. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  289. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  290. package/build-module/components/post-taxonomies/index.js +1 -0
  291. package/build-module/components/post-taxonomies/index.js.map +1 -1
  292. package/build-module/components/post-taxonomies/most-used-terms.js +1 -0
  293. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  294. package/build-module/components/post-template/classic-theme.js +1 -0
  295. package/build-module/components/post-template/classic-theme.js.map +1 -1
  296. package/build-module/components/post-template/swap-template-button.js +1 -0
  297. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  298. package/build-module/components/post-transform-panel/hooks.js +1 -0
  299. package/build-module/components/post-transform-panel/hooks.js.map +1 -1
  300. package/build-module/components/post-type-support-check/index.js +1 -0
  301. package/build-module/components/post-type-support-check/index.js.map +1 -1
  302. package/build-module/components/preferences-modal/block-visibility.js +1 -0
  303. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  304. package/build-module/components/preferences-modal/index.js +3 -4
  305. package/build-module/components/preferences-modal/index.js.map +1 -1
  306. package/build-module/components/preview-dropdown/index.js +0 -1
  307. package/build-module/components/preview-dropdown/index.js.map +1 -1
  308. package/build-module/components/provider/disable-non-page-content-blocks.js +66 -13
  309. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  310. package/build-module/components/provider/index.js +10 -14
  311. package/build-module/components/provider/index.js.map +1 -1
  312. package/build-module/components/provider/index.native.js +1 -0
  313. package/build-module/components/provider/index.native.js.map +1 -1
  314. package/build-module/components/provider/use-block-editor-settings.js +4 -1
  315. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  316. package/build-module/components/sidebar/index.js +1 -0
  317. package/build-module/components/sidebar/index.js.map +1 -1
  318. package/build-module/components/start-page-options/index.js +21 -106
  319. package/build-module/components/start-page-options/index.js.map +1 -1
  320. package/build-module/components/start-template-options/index.js +1 -0
  321. package/build-module/components/start-template-options/index.js.map +1 -1
  322. package/build-module/components/template-part-content-panel/index.js +1 -0
  323. package/build-module/components/template-part-content-panel/index.js.map +1 -1
  324. package/build-module/components/template-part-menu-items/index.js +2 -10
  325. package/build-module/components/template-part-menu-items/index.js.map +1 -1
  326. package/build-module/components/theme-support-check/index.js +1 -0
  327. package/build-module/components/theme-support-check/index.js.map +1 -1
  328. package/build-module/components/visual-editor/use-select-nearest-editable-block.js +1 -0
  329. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  330. package/build-module/dataviews/store/private-actions.js +16 -2
  331. package/build-module/dataviews/store/private-actions.js.map +1 -1
  332. package/build-module/dataviews/store/reducer.js +1 -0
  333. package/build-module/dataviews/store/reducer.js.map +1 -1
  334. package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -0
  335. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  336. package/build-module/hooks/pattern-overrides.js +1 -0
  337. package/build-module/hooks/pattern-overrides.js.map +1 -1
  338. package/build-module/store/actions.js +1 -2
  339. package/build-module/store/actions.js.map +1 -1
  340. package/build-module/store/constants.js +0 -2
  341. package/build-module/store/constants.js.map +1 -1
  342. package/build-module/store/private-actions.js +2 -1
  343. package/build-module/store/private-actions.js.map +1 -1
  344. package/build-module/store/private-selectors.js +1 -0
  345. package/build-module/store/private-selectors.js.map +1 -1
  346. package/build-module/store/reducer.js +1 -0
  347. package/build-module/store/reducer.js.map +1 -1
  348. package/build-module/store/reducer.native.js +1 -0
  349. package/build-module/store/reducer.native.js.map +1 -1
  350. package/build-module/store/selectors.js +1 -0
  351. package/build-module/store/selectors.js.map +1 -1
  352. package/build-module/store/utils/notice-builder.js +3 -8
  353. package/build-module/store/utils/notice-builder.js.map +1 -1
  354. package/build-module/utils/get-item-title.js +26 -0
  355. package/build-module/utils/get-item-title.js.map +1 -0
  356. package/build-module/utils/get-template-info.js +1 -0
  357. package/build-module/utils/get-template-info.js.map +1 -1
  358. package/build-module/utils/media-sideload/index.js +14 -0
  359. package/build-module/utils/media-sideload/index.js.map +1 -0
  360. package/build-module/utils/media-sideload/index.native.js +2 -0
  361. package/build-module/utils/media-sideload/index.native.js.map +1 -0
  362. package/build-module/utils/media-upload/index.js +5 -2
  363. package/build-module/utils/media-upload/index.js.map +1 -1
  364. package/build-module/utils/pageTypeBadge.js +6 -12
  365. package/build-module/utils/pageTypeBadge.js.map +1 -1
  366. package/build-module/utils/terms.js +1 -0
  367. package/build-module/utils/terms.js.map +1 -1
  368. package/build-style/style-rtl.css +26 -27
  369. package/build-style/style.css +26 -27
  370. package/build-types/components/autocompleters/user.d.ts +7 -1
  371. package/build-types/components/autocompleters/user.d.ts.map +1 -1
  372. package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -1
  373. package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -1
  374. package/build-types/components/collab-sidebar/comments.d.ts +11 -7
  375. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  376. package/build-types/components/collab-sidebar/constants.d.ts.map +1 -1
  377. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  378. package/build-types/components/commands/index.d.ts.map +1 -1
  379. package/build-types/components/document-bar/index.d.ts.map +1 -1
  380. package/build-types/components/document-tools/index.d.ts.map +1 -1
  381. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  382. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  383. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +1 -1
  384. package/build-types/components/media-categories/index.d.ts.map +1 -1
  385. package/build-types/components/more-menu/index.d.ts.map +1 -1
  386. package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -1
  387. package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -1
  388. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  389. package/build-types/components/post-actions/index.d.ts +5 -0
  390. package/build-types/components/post-actions/index.d.ts.map +1 -1
  391. package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
  392. package/build-types/components/post-actions/set-as-posts-page.d.ts +10 -0
  393. package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -0
  394. package/build-types/components/post-card-panel/index.d.ts +13 -4
  395. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  396. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +4 -4
  397. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  398. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +4 -4
  399. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  400. package/build-types/components/post-title/constants.d.ts.map +1 -1
  401. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  402. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  403. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  404. package/build-types/components/provider/index.d.ts.map +1 -1
  405. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  406. package/build-types/components/start-page-options/index.d.ts +1 -2
  407. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  408. package/build-types/dataviews/api.d.ts.map +1 -1
  409. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  410. package/build-types/dataviews/store/reducer.d.ts +1 -1
  411. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
  412. package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
  413. package/build-types/store/actions.d.ts +7 -9
  414. package/build-types/store/actions.d.ts.map +1 -1
  415. package/build-types/store/constants.d.ts +0 -2
  416. package/build-types/store/constants.d.ts.map +1 -1
  417. package/build-types/store/private-actions.d.ts +1 -1
  418. package/build-types/store/private-actions.d.ts.map +1 -1
  419. package/build-types/store/private-selectors.d.ts +20 -4
  420. package/build-types/store/private-selectors.d.ts.map +1 -1
  421. package/build-types/store/reducer.d.ts +1 -1
  422. package/build-types/store/selectors.d.ts +376 -76
  423. package/build-types/store/selectors.d.ts.map +1 -1
  424. package/build-types/store/utils/notice-builder.d.ts.map +1 -1
  425. package/build-types/utils/get-item-title.d.ts +10 -0
  426. package/build-types/utils/get-item-title.d.ts.map +1 -0
  427. package/build-types/utils/media-sideload/index.d.ts +3 -0
  428. package/build-types/utils/media-sideload/index.d.ts.map +1 -0
  429. package/build-types/utils/media-upload/index.d.ts +3 -1
  430. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  431. package/build-types/utils/pageTypeBadge.d.ts +3 -1
  432. package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
  433. package/package.json +37 -37
  434. package/src/components/collab-sidebar/add-comment.js +1 -1
  435. package/src/components/collab-sidebar/comment-button.js +12 -7
  436. package/src/components/collab-sidebar/comment-form.js +4 -1
  437. package/src/components/collab-sidebar/comments.js +260 -243
  438. package/src/components/collab-sidebar/index.js +10 -2
  439. package/src/components/collab-sidebar/style.scss +10 -1
  440. package/src/components/commands/index.js +29 -0
  441. package/src/components/document-bar/index.js +5 -2
  442. package/src/components/document-tools/index.js +3 -6
  443. package/src/components/document-tools/style.scss +0 -6
  444. package/src/components/editor-help/intro-to-blocks.native.js +1 -1
  445. package/src/components/entities-saved-states/index.js +5 -1
  446. package/src/components/error-boundary/index.js +30 -16
  447. package/src/components/error-boundary/index.native.js +2 -2
  448. package/src/components/error-boundary/style.scss +5 -1
  449. package/src/components/more-menu/index.js +0 -1
  450. package/src/components/post-actions/actions.js +12 -4
  451. package/src/components/post-actions/index.js +90 -94
  452. package/src/components/post-actions/set-as-homepage.js +29 -45
  453. package/src/components/post-actions/set-as-posts-page.js +164 -0
  454. package/src/components/post-card-panel/index.js +71 -33
  455. package/src/components/post-card-panel/style.scss +8 -12
  456. package/src/components/post-publish-panel/maybe-upload-media.js +2 -2
  457. package/src/components/post-publish-panel/prepublish.js +1 -1
  458. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  459. package/src/components/preferences-modal/index.js +8 -13
  460. package/src/components/preview-dropdown/index.js +0 -1
  461. package/src/components/provider/disable-non-page-content-blocks.js +64 -13
  462. package/src/components/provider/index.js +13 -27
  463. package/src/components/provider/use-block-editor-settings.js +3 -0
  464. package/src/components/start-page-options/index.js +28 -119
  465. package/src/components/template-part-menu-items/index.js +2 -11
  466. package/src/dataviews/store/private-actions.ts +23 -8
  467. package/src/store/actions.js +0 -2
  468. package/src/store/constants.ts +0 -2
  469. package/src/store/private-actions.js +1 -1
  470. package/src/store/utils/notice-builder.js +3 -8
  471. package/src/store/utils/test/notice-builder.js +3 -4
  472. package/src/utils/get-item-title.js +25 -0
  473. package/src/utils/media-sideload/index.js +13 -0
  474. package/src/utils/media-sideload/index.native.js +1 -0
  475. package/src/utils/media-upload/index.js +4 -1
  476. package/src/utils/pageTypeBadge.js +7 -10
  477. package/tsconfig.json +1 -4
  478. package/tsconfig.tsbuildinfo +1 -1
@@ -1,16 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { Modal } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
6
- import { useState, useMemo } from '@wordpress/element';
7
- import {
8
- store as blockEditorStore,
9
- __experimentalBlockPatternsList as BlockPatternsList,
10
- } from '@wordpress/block-editor';
4
+ import { useEffect } from '@wordpress/element';
11
5
  import { useSelect, useDispatch } from '@wordpress/data';
12
- import { store as coreStore } from '@wordpress/core-data';
13
- import { __unstableSerializeAndClean } from '@wordpress/blocks';
14
6
  import { store as preferencesStore } from '@wordpress/preferences';
15
7
  import { store as interfaceStore } from '@wordpress/interface';
16
8
 
@@ -18,124 +10,41 @@ import { store as interfaceStore } from '@wordpress/interface';
18
10
  * Internal dependencies
19
11
  */
20
12
  import { store as editorStore } from '../../store';
21
- import { TEMPLATE_POST_TYPE } from '../../store/constants';
22
-
23
- export function useStartPatterns() {
24
- // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
25
- // and it has no postTypes declared and the current post type is page or if
26
- // the current post type is part of the postTypes declared.
27
- const { blockPatternsWithPostContentBlockType, postType } = useSelect(
28
- ( select ) => {
29
- const { getPatternsByBlockTypes, getBlocksByName } =
30
- select( blockEditorStore );
31
- const { getCurrentPostType, getRenderingMode } =
32
- select( editorStore );
33
- const rootClientId =
34
- getRenderingMode() === 'post-only'
35
- ? ''
36
- : getBlocksByName( 'core/post-content' )?.[ 0 ];
37
- return {
38
- blockPatternsWithPostContentBlockType: getPatternsByBlockTypes(
39
- 'core/post-content',
40
- rootClientId
41
- ),
42
- postType: getCurrentPostType(),
43
- };
44
- },
45
- []
46
- );
47
-
48
- return useMemo( () => {
49
- if ( ! blockPatternsWithPostContentBlockType?.length ) {
50
- return [];
51
- }
52
-
53
- /*
54
- * Filter patterns without postTypes declared if the current postType is page
55
- * or patterns that declare the current postType in its post type array.
56
- */
57
- return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
58
- return (
59
- ( postType === 'page' && ! pattern.postTypes ) ||
60
- ( Array.isArray( pattern.postTypes ) &&
61
- pattern.postTypes.includes( postType ) )
62
- );
63
- } );
64
- }, [ postType, blockPatternsWithPostContentBlockType ] );
65
- }
66
-
67
- function PatternSelection( { blockPatterns, onChoosePattern } ) {
68
- const { editEntityRecord } = useDispatch( coreStore );
69
- const { postType, postId } = useSelect( ( select ) => {
70
- const { getCurrentPostType, getCurrentPostId } = select( editorStore );
71
-
72
- return {
73
- postType: getCurrentPostType(),
74
- postId: getCurrentPostId(),
75
- };
76
- }, [] );
77
- return (
78
- <BlockPatternsList
79
- blockPatterns={ blockPatterns }
80
- onClickPattern={ ( _pattern, blocks ) => {
81
- editEntityRecord( 'postType', postType, postId, {
82
- blocks,
83
- content: ( { blocks: blocksForSerialization = [] } ) =>
84
- __unstableSerializeAndClean( blocksForSerialization ),
85
- } );
86
- onChoosePattern();
87
- } }
88
- />
89
- );
90
- }
91
-
92
- function StartPageOptionsModal( { onClose } ) {
93
- const startPatterns = useStartPatterns();
94
- const hasStartPattern = startPatterns.length > 0;
95
-
96
- if ( ! hasStartPattern ) {
97
- return null;
98
- }
99
-
100
- return (
101
- <Modal
102
- title={ __( 'Choose a pattern' ) }
103
- isFullScreen
104
- onRequestClose={ onClose }
105
- >
106
- <div className="editor-start-page-options__modal-content">
107
- <PatternSelection
108
- blockPatterns={ startPatterns }
109
- onChoosePattern={ onClose }
110
- />
111
- </div>
112
- </Modal>
113
- );
114
- }
115
13
 
116
14
  export default function StartPageOptions() {
117
- const [ isClosed, setIsClosed ] = useState( false );
118
- const shouldEnableModal = useSelect( ( select ) => {
119
- const { isEditedPostDirty, isEditedPostEmpty, getCurrentPostType } =
120
- select( editorStore );
15
+ const { postId, shouldEnable } = useSelect( ( select ) => {
16
+ const {
17
+ isEditedPostDirty,
18
+ isEditedPostEmpty,
19
+ getCurrentPostId,
20
+ getCurrentPostType,
21
+ } = select( editorStore );
121
22
  const preferencesModalActive =
122
23
  select( interfaceStore ).isModalActive( 'editor/preferences' );
123
24
  const choosePatternModalEnabled = select( preferencesStore ).get(
124
25
  'core',
125
26
  'enableChoosePatternModal'
126
27
  );
127
- return (
128
- choosePatternModalEnabled &&
129
- ! preferencesModalActive &&
130
- ! isEditedPostDirty() &&
131
- isEditedPostEmpty() &&
132
- TEMPLATE_POST_TYPE !== getCurrentPostType()
133
- );
28
+ return {
29
+ postId: getCurrentPostId(),
30
+ shouldEnable:
31
+ choosePatternModalEnabled &&
32
+ ! preferencesModalActive &&
33
+ ! isEditedPostDirty() &&
34
+ isEditedPostEmpty() &&
35
+ 'page' === getCurrentPostType(),
36
+ };
134
37
  }, [] );
38
+ const { setIsInserterOpened } = useDispatch( editorStore );
39
+
40
+ useEffect( () => {
41
+ if ( shouldEnable ) {
42
+ setIsInserterOpened( {
43
+ tab: 'patterns',
44
+ category: 'core/starter-content',
45
+ } );
46
+ }
47
+ }, [ postId, shouldEnable, setIsInserterOpened ] );
135
48
 
136
- if ( ! shouldEnableModal || isClosed ) {
137
- return null;
138
- }
139
-
140
- return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
49
+ return null;
141
50
  }
@@ -27,25 +27,16 @@ export default function TemplatePartMenuItems() {
27
27
  }
28
28
 
29
29
  function TemplatePartConverterMenuItem( { clientIds, onClose } ) {
30
- const { isContentOnly, blocks } = useSelect(
30
+ const { blocks } = useSelect(
31
31
  ( select ) => {
32
- const { getBlocksByClientId, getBlockEditingMode } =
33
- select( blockEditorStore );
32
+ const { getBlocksByClientId } = select( blockEditorStore );
34
33
  return {
35
34
  blocks: getBlocksByClientId( clientIds ),
36
- isContentOnly:
37
- clientIds.length === 1 &&
38
- getBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',
39
35
  };
40
36
  },
41
37
  [ clientIds ]
42
38
  );
43
39
 
44
- // Do not show the convert button if the block is in content-only mode.
45
- if ( isContentOnly ) {
46
- return null;
47
- }
48
-
49
40
  // Allow converting a single template part to standard blocks.
50
41
  if ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {
51
42
  return (
@@ -4,12 +4,6 @@
4
4
  import { store as coreStore } from '@wordpress/core-data';
5
5
  import type { Action, Field } from '@wordpress/dataviews';
6
6
  import { doAction } from '@wordpress/hooks';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import { store as editorStore } from '../../store';
12
- import { unlock } from '../../lock-unlock';
13
7
  import type { PostType } from '@wordpress/fields';
14
8
  import {
15
9
  viewPost,
@@ -35,8 +29,17 @@ import {
35
29
  authorField,
36
30
  titleField,
37
31
  templateField,
32
+ templateTitleField,
33
+ pageTitleField,
34
+ patternTitleField,
38
35
  } from '@wordpress/fields';
39
36
 
37
+ /**
38
+ * Internal dependencies
39
+ */
40
+ import { store as editorStore } from '../../store';
41
+ import { unlock } from '../../lock-unlock';
42
+
40
43
  export function registerEntityAction< Item >(
41
44
  kind: string,
42
45
  name: string,
@@ -164,16 +167,28 @@ export const registerPostTypeSchema =
164
167
  postTypeConfig.supports?.thumbnail &&
165
168
  currentTheme?.theme_supports?.[ 'post-thumbnails' ] &&
166
169
  featuredImageField,
167
- titleField,
168
170
  postTypeConfig.supports?.author && authorField,
169
171
  statusField,
170
172
  dateField,
171
173
  slugField,
172
174
  postTypeConfig.supports?.[ 'page-attributes' ] && parentField,
173
175
  postTypeConfig.supports?.comments && commentStatusField,
174
- passwordField,
175
176
  templateField,
177
+ passwordField,
176
178
  ].filter( Boolean );
179
+ if ( postTypeConfig.supports?.title ) {
180
+ let _titleField;
181
+ if ( postType === 'page' ) {
182
+ _titleField = pageTitleField;
183
+ } else if ( postType === 'wp_template' ) {
184
+ _titleField = templateTitleField;
185
+ } else if ( postType === 'wp_block' ) {
186
+ _titleField = patternTitleField;
187
+ } else {
188
+ _titleField = titleField;
189
+ }
190
+ fields.push( _titleField );
191
+ }
177
192
 
178
193
  registry.batch( () => {
179
194
  actions.forEach( ( action ) => {
@@ -23,7 +23,6 @@ import { __ } from '@wordpress/i18n';
23
23
  /**
24
24
  * Internal dependencies
25
25
  */
26
- import { TRASH_POST_NOTICE_ID } from './constants';
27
26
  import { localAutosaveSet } from './local-autosave';
28
27
  import {
29
28
  getNotificationArgumentsForSaveSuccess,
@@ -347,7 +346,6 @@ export const trashPost =
347
346
  const postType = await registry
348
347
  .resolveSelect( coreStore )
349
348
  .getPostType( postTypeSlug );
350
- registry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID );
351
349
  const { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } =
352
350
  postType;
353
351
  dispatch( { type: 'REQUEST_POST_DELETE_START' } );
@@ -11,8 +11,6 @@ export const EDIT_MERGE_PROPERTIES = new Set( [ 'meta' ] );
11
11
  */
12
12
  export const STORE_NAME = 'core/editor';
13
13
 
14
- export const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
15
- export const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
16
14
  export const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
17
15
  export const ONE_MINUTE_IN_MS = 60 * 1000;
18
16
  export const AUTOSAVE_PROPERTIES = [ 'title', 'excerpt', 'content' ];
@@ -34,7 +34,7 @@ export function setCurrentTemplateId( id ) {
34
34
  /**
35
35
  * Create a block based template.
36
36
  *
37
- * @param {Object?} template Template to create and assign.
37
+ * @param {?Object} template Template to create and assign.
38
38
  */
39
39
  export const createTemplate =
40
40
  ( template ) =>
@@ -3,11 +3,6 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- /**
7
- * Internal dependencies
8
- */
9
- import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
10
-
11
6
  /**
12
7
  * Builds the arguments for a success notification dispatch.
13
8
  *
@@ -68,7 +63,7 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
68
63
  return [
69
64
  noticeMessage,
70
65
  {
71
- id: SAVE_POST_NOTICE_ID,
66
+ id: 'editor-save',
72
67
  type: 'snackbar',
73
68
  actions,
74
69
  },
@@ -113,7 +108,7 @@ export function getNotificationArgumentsForSaveFail( data ) {
113
108
  return [
114
109
  noticeMessage,
115
110
  {
116
- id: SAVE_POST_NOTICE_ID,
111
+ id: 'editor-save',
117
112
  },
118
113
  ];
119
114
  }
@@ -131,7 +126,7 @@ export function getNotificationArgumentsForTrashFail( data ) {
131
126
  ? data.error.message
132
127
  : __( 'Trashing failed' ),
133
128
  {
134
- id: TRASH_POST_NOTICE_ID,
129
+ id: 'editor-trash-fail',
135
130
  },
136
131
  ];
137
132
  }
@@ -6,7 +6,6 @@ import {
6
6
  getNotificationArgumentsForSaveFail,
7
7
  getNotificationArgumentsForTrashFail,
8
8
  } from '../notice-builder';
9
- import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../../constants';
10
9
 
11
10
  describe( 'getNotificationArgumentsForSaveSuccess()', () => {
12
11
  const postType = {
@@ -27,7 +26,7 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
27
26
  };
28
27
  const post = { ...previousPost };
29
28
  const defaultExpectedAction = {
30
- id: SAVE_POST_NOTICE_ID,
29
+ id: 'editor-save',
31
30
  actions: [],
32
31
  type: 'snackbar',
33
32
  };
@@ -106,7 +105,7 @@ describe( 'getNotificationArgumentsForSaveFail()', () => {
106
105
  const error = { code: '42', message: 'Something went wrong.' };
107
106
  const post = { status: 'publish' };
108
107
  const edits = { status: 'publish' };
109
- const defaultExpectedAction = { id: SAVE_POST_NOTICE_ID };
108
+ const defaultExpectedAction = { id: 'editor-save' };
110
109
  [
111
110
  [
112
111
  'when error code is `rest_autosave_no_changes`',
@@ -190,7 +189,7 @@ describe( 'getNotificationArgumentsForTrashFail()', () => {
190
189
  ].forEach( ( [ description, error, message ] ) => {
191
190
  // eslint-disable-next-line jest/valid-title
192
191
  it( description, () => {
193
- const expectedValue = [ message, { id: TRASH_POST_NOTICE_ID } ];
192
+ const expectedValue = [ message, { id: 'editor-trash-fail' } ];
194
193
  expect( getNotificationArgumentsForTrashFail( { error } ) ).toEqual(
195
194
  expectedValue
196
195
  );
@@ -0,0 +1,25 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { decodeEntities } from '@wordpress/html-entities';
5
+
6
+ /**
7
+ * Helper function to get the title of a post item.
8
+ * This is duplicated from the `@wordpress/fields` package.
9
+ * `packages/fields/src/actions/utils.ts`
10
+ *
11
+ * @param {Object} item The post item.
12
+ * @return {string} The title of the item, or an empty string if the title is not found.
13
+ */
14
+ export function getItemTitle( item ) {
15
+ if ( typeof item.title === 'string' ) {
16
+ return decodeEntities( item.title );
17
+ }
18
+ if ( item.title && 'rendered' in item.title ) {
19
+ return decodeEntities( item.title.rendered );
20
+ }
21
+ if ( item.title && 'raw' in item.title ) {
22
+ return decodeEntities( item.title.raw );
23
+ }
24
+ return '';
25
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis } from '@wordpress/media-utils';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { unlock } from '../../lock-unlock';
10
+
11
+ const { sideloadMedia: mediaSideload } = unlock( privateApis );
12
+
13
+ export default mediaSideload;
@@ -0,0 +1 @@
1
+ export default function mediaSideload() {}
@@ -27,6 +27,7 @@ const noop = () => {};
27
27
  * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
28
28
  * @param {Function} $0.onError Function called when an error happens.
29
29
  * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
30
+ * @param {Function} $0.onSuccess Function called after the final representation of the file is available.
30
31
  */
31
32
  export default function mediaUpload( {
32
33
  additionalData = {},
@@ -35,6 +36,7 @@ export default function mediaUpload( {
35
36
  maxUploadFileSize,
36
37
  onError = noop,
37
38
  onFileChange,
39
+ onSuccess,
38
40
  } ) {
39
41
  const { getCurrentPost, getEditorSettings } = select( editorStore );
40
42
  const {
@@ -77,8 +79,9 @@ export default function mediaUpload( {
77
79
  } else {
78
80
  clearSaveLock();
79
81
  }
80
- onFileChange( file );
82
+ onFileChange?.( file );
81
83
  },
84
+ onSuccess,
82
85
  additionalData: {
83
86
  ...postData,
84
87
  ...additionalData,
@@ -5,19 +5,14 @@ import { __ } from '@wordpress/i18n';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
7
 
8
- /**
9
- * Internal dependencies
10
- */
11
- import { store as editorStore } from '../store';
12
-
13
8
  /**
14
9
  * Custom hook to get the page type badge for the current post on edit site view.
10
+ *
11
+ * @param {number|string} postId postId of the current post being edited.
15
12
  */
16
- export default function usePageTypeBadge() {
13
+ export default function usePageTypeBadge( postId ) {
17
14
  const { isFrontPage, isPostsPage } = useSelect( ( select ) => {
18
- const { getCurrentPostId } = select( editorStore );
19
15
  const { canUser, getEditedEntityRecord } = select( coreStore );
20
- const postId = getCurrentPostId();
21
16
  const siteSettings = canUser( 'read', {
22
17
  kind: 'root',
23
18
  name: 'site',
@@ -25,9 +20,11 @@ export default function usePageTypeBadge() {
25
20
  ? getEditedEntityRecord( 'root', 'site' )
26
21
  : undefined;
27
22
 
23
+ const _postId = parseInt( postId, 10 );
24
+
28
25
  return {
29
- isFrontPage: siteSettings?.page_on_front === postId,
30
- isPostsPage: siteSettings?.page_for_posts === postId,
26
+ isFrontPage: siteSettings?.page_on_front === _postId,
27
+ isPostsPage: siteSettings?.page_for_posts === _postId,
31
28
  };
32
29
  } );
33
30
 
package/tsconfig.json CHANGED
@@ -2,8 +2,6 @@
2
2
  "$schema": "https://json.schemastore.org/tsconfig.json",
3
3
  "extends": "../../tsconfig.base.json",
4
4
  "compilerOptions": {
5
- "rootDir": "src",
6
- "declarationDir": "build-types",
7
5
  "checkJs": false
8
6
  },
9
7
  "references": [
@@ -34,6 +32,5 @@
34
32
  { "path": "../url" },
35
33
  { "path": "../warning" },
36
34
  { "path": "../wordcount" }
37
- ],
38
- "include": [ "src" ]
35
+ ]
39
36
  }