@wordpress/editor 14.6.0 → 14.7.1-next.5368f64a9.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 (354) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +41 -0
  3. package/build/bindings/post-meta.js +11 -8
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/block-manager/index.js +4 -1
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
  8. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  9. package/build/components/document-bar/index.js +4 -4
  10. package/build/components/document-bar/index.js.map +1 -1
  11. package/build/components/editor/index.js +2 -2
  12. package/build/components/editor/index.js.map +1 -1
  13. package/build/components/editor-history/redo.js +4 -1
  14. package/build/components/editor-history/redo.js.map +1 -1
  15. package/build/components/editor-history/undo.js +4 -1
  16. package/build/components/editor-history/undo.js.map +1 -1
  17. package/build/components/editor-interface/index.js +2 -3
  18. package/build/components/editor-interface/index.js.map +1 -1
  19. package/build/components/error-boundary/index.js +4 -1
  20. package/build/components/error-boundary/index.js.map +1 -1
  21. package/build/components/global-styles-provider/index.js +3 -4
  22. package/build/components/global-styles-provider/index.js.map +1 -1
  23. package/build/components/header/index.js +4 -4
  24. package/build/components/header/index.js.map +1 -1
  25. package/build/components/index.js +8 -0
  26. package/build/components/index.js.map +1 -1
  27. package/build/components/inserter-sidebar/index.js +5 -10
  28. package/build/components/inserter-sidebar/index.js.map +1 -1
  29. package/build/components/local-autosave-monitor/index.js +5 -5
  30. package/build/components/local-autosave-monitor/index.js.map +1 -1
  31. package/build/components/page-attributes/parent.js +4 -1
  32. package/build/components/page-attributes/parent.js.map +1 -1
  33. package/build/components/plugin-preview-menu-item/index.js +57 -0
  34. package/build/components/plugin-preview-menu-item/index.js.map +1 -0
  35. package/build/components/post-actions/index.js +5 -8
  36. package/build/components/post-actions/index.js.map +1 -1
  37. package/build/components/post-excerpt/panel.js +4 -1
  38. package/build/components/post-excerpt/panel.js.map +1 -1
  39. package/build/components/post-featured-image/index.js +12 -3
  40. package/build/components/post-featured-image/index.js.map +1 -1
  41. package/build/components/post-format/index.js +4 -1
  42. package/build/components/post-format/index.js.map +1 -1
  43. package/build/components/post-last-revision/index.js +4 -1
  44. package/build/components/post-last-revision/index.js.map +1 -1
  45. package/build/components/post-locked-modal/index.js +12 -3
  46. package/build/components/post-locked-modal/index.js.map +1 -1
  47. package/build/components/post-publish-panel/index.js +4 -1
  48. package/build/components/post-publish-panel/index.js.map +1 -1
  49. package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  50. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  51. package/build/components/post-publish-panel/maybe-upload-media.js +158 -33
  52. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  53. package/build/components/post-publish-panel/media-util.js +79 -0
  54. package/build/components/post-publish-panel/media-util.js.map +1 -0
  55. package/build/components/post-status/index.js +4 -2
  56. package/build/components/post-status/index.js.map +1 -1
  57. package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  58. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  59. package/build/components/post-taxonomies/most-used-terms.js +4 -1
  60. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  61. package/build/components/post-template/block-theme.js +13 -4
  62. package/build/components/post-template/block-theme.js.map +1 -1
  63. package/build/components/post-template/classic-theme.js +4 -1
  64. package/build/components/post-template/classic-theme.js.map +1 -1
  65. package/build/components/post-title/index.js +32 -46
  66. package/build/components/post-title/index.js.map +1 -1
  67. package/build/components/post-trash/check.js +2 -1
  68. package/build/components/post-trash/check.js.map +1 -1
  69. package/build/components/post-trash/index.js +22 -8
  70. package/build/components/post-trash/index.js.map +1 -1
  71. package/build/components/post-url/index.js +4 -1
  72. package/build/components/post-url/index.js.map +1 -1
  73. package/build/components/preferences-modal/index.js +28 -1
  74. package/build/components/preferences-modal/index.js.map +1 -1
  75. package/build/components/preview-dropdown/index.js +26 -14
  76. package/build/components/preview-dropdown/index.js.map +1 -1
  77. package/build/components/provider/index.js +34 -8
  78. package/build/components/provider/index.js.map +1 -1
  79. package/build/components/provider/use-block-editor-settings.js +14 -10
  80. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  81. package/build/components/save-publish-panels/index.js +8 -2
  82. package/build/components/save-publish-panels/index.js.map +1 -1
  83. package/build/components/sidebar/post-summary.js +3 -0
  84. package/build/components/sidebar/post-summary.js.map +1 -1
  85. package/build/components/start-page-options/index.js +16 -19
  86. package/build/components/start-page-options/index.js.map +1 -1
  87. package/build/components/start-template-options/index.js +1 -0
  88. package/build/components/start-template-options/index.js.map +1 -1
  89. package/build/components/table-of-contents/index.js +1 -0
  90. package/build/components/table-of-contents/index.js.map +1 -1
  91. package/build/components/text-editor/index.js +1 -0
  92. package/build/components/text-editor/index.js.map +1 -1
  93. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  94. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  95. package/build/components/visual-editor/index.js +1 -6
  96. package/build/components/visual-editor/index.js.map +1 -1
  97. package/build/dataviews/actions/export-pattern.js +2 -0
  98. package/build/dataviews/actions/export-pattern.js.map +1 -1
  99. package/build/dataviews/actions/permanently-delete-post.js +2 -0
  100. package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
  101. package/build/dataviews/actions/reset-post.js +2 -0
  102. package/build/dataviews/actions/reset-post.js.map +1 -1
  103. package/build/dataviews/actions/trash-post.js +2 -0
  104. package/build/dataviews/actions/trash-post.js.map +1 -1
  105. package/build/dataviews/actions/view-post.js +1 -1
  106. package/build/dataviews/actions/view-post.js.map +1 -1
  107. package/build/private-apis.js +0 -2
  108. package/build/private-apis.js.map +1 -1
  109. package/build/store/private-actions.js +1 -1
  110. package/build/store/private-actions.js.map +1 -1
  111. package/build/store/selectors.js +7 -3
  112. package/build/store/selectors.js.map +1 -1
  113. package/build-module/bindings/post-meta.js +11 -8
  114. package/build-module/bindings/post-meta.js.map +1 -1
  115. package/build-module/components/block-manager/index.js +4 -1
  116. package/build-module/components/block-manager/index.js.map +1 -1
  117. package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
  118. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  119. package/build-module/components/document-bar/index.js +4 -4
  120. package/build-module/components/document-bar/index.js.map +1 -1
  121. package/build-module/components/editor/index.js +2 -2
  122. package/build-module/components/editor/index.js.map +1 -1
  123. package/build-module/components/editor-history/redo.js +4 -1
  124. package/build-module/components/editor-history/redo.js.map +1 -1
  125. package/build-module/components/editor-history/undo.js +4 -1
  126. package/build-module/components/editor-history/undo.js.map +1 -1
  127. package/build-module/components/editor-interface/index.js +2 -3
  128. package/build-module/components/editor-interface/index.js.map +1 -1
  129. package/build-module/components/error-boundary/index.js +4 -1
  130. package/build-module/components/error-boundary/index.js.map +1 -1
  131. package/build-module/components/global-styles-provider/index.js +3 -4
  132. package/build-module/components/global-styles-provider/index.js.map +1 -1
  133. package/build-module/components/header/index.js +4 -4
  134. package/build-module/components/header/index.js.map +1 -1
  135. package/build-module/components/index.js +1 -0
  136. package/build-module/components/index.js.map +1 -1
  137. package/build-module/components/inserter-sidebar/index.js +5 -10
  138. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  139. package/build-module/components/local-autosave-monitor/index.js +5 -5
  140. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  141. package/build-module/components/page-attributes/parent.js +4 -1
  142. package/build-module/components/page-attributes/parent.js.map +1 -1
  143. package/build-module/components/plugin-preview-menu-item/index.js +52 -0
  144. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
  145. package/build-module/components/post-actions/index.js +5 -8
  146. package/build-module/components/post-actions/index.js.map +1 -1
  147. package/build-module/components/post-excerpt/panel.js +4 -1
  148. package/build-module/components/post-excerpt/panel.js.map +1 -1
  149. package/build-module/components/post-featured-image/index.js +12 -3
  150. package/build-module/components/post-featured-image/index.js.map +1 -1
  151. package/build-module/components/post-format/index.js +4 -1
  152. package/build-module/components/post-format/index.js.map +1 -1
  153. package/build-module/components/post-last-revision/index.js +4 -1
  154. package/build-module/components/post-last-revision/index.js.map +1 -1
  155. package/build-module/components/post-locked-modal/index.js +12 -3
  156. package/build-module/components/post-locked-modal/index.js.map +1 -1
  157. package/build-module/components/post-publish-panel/index.js +4 -1
  158. package/build-module/components/post-publish-panel/index.js.map +1 -1
  159. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
  160. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  161. package/build-module/components/post-publish-panel/maybe-upload-media.js +157 -32
  162. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  163. package/build-module/components/post-publish-panel/media-util.js +72 -0
  164. package/build-module/components/post-publish-panel/media-util.js.map +1 -0
  165. package/build-module/components/post-status/index.js +4 -2
  166. package/build-module/components/post-status/index.js.map +1 -1
  167. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
  168. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  169. package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
  170. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  171. package/build-module/components/post-template/block-theme.js +13 -4
  172. package/build-module/components/post-template/block-theme.js.map +1 -1
  173. package/build-module/components/post-template/classic-theme.js +4 -1
  174. package/build-module/components/post-template/classic-theme.js.map +1 -1
  175. package/build-module/components/post-title/index.js +33 -47
  176. package/build-module/components/post-title/index.js.map +1 -1
  177. package/build-module/components/post-trash/check.js +2 -1
  178. package/build-module/components/post-trash/check.js.map +1 -1
  179. package/build-module/components/post-trash/index.js +23 -11
  180. package/build-module/components/post-trash/index.js.map +1 -1
  181. package/build-module/components/post-url/index.js +4 -1
  182. package/build-module/components/post-url/index.js.map +1 -1
  183. package/build-module/components/preferences-modal/index.js +28 -1
  184. package/build-module/components/preferences-modal/index.js.map +1 -1
  185. package/build-module/components/preview-dropdown/index.js +26 -14
  186. package/build-module/components/preview-dropdown/index.js.map +1 -1
  187. package/build-module/components/provider/index.js +35 -9
  188. package/build-module/components/provider/index.js.map +1 -1
  189. package/build-module/components/provider/use-block-editor-settings.js +15 -11
  190. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  191. package/build-module/components/save-publish-panels/index.js +8 -2
  192. package/build-module/components/save-publish-panels/index.js.map +1 -1
  193. package/build-module/components/sidebar/post-summary.js +3 -0
  194. package/build-module/components/sidebar/post-summary.js.map +1 -1
  195. package/build-module/components/start-page-options/index.js +17 -21
  196. package/build-module/components/start-page-options/index.js.map +1 -1
  197. package/build-module/components/start-template-options/index.js +1 -0
  198. package/build-module/components/start-template-options/index.js.map +1 -1
  199. package/build-module/components/table-of-contents/index.js +1 -0
  200. package/build-module/components/table-of-contents/index.js.map +1 -1
  201. package/build-module/components/text-editor/index.js +1 -0
  202. package/build-module/components/text-editor/index.js.map +1 -1
  203. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  204. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  205. package/build-module/components/visual-editor/index.js +1 -6
  206. package/build-module/components/visual-editor/index.js.map +1 -1
  207. package/build-module/dataviews/actions/export-pattern.js +2 -0
  208. package/build-module/dataviews/actions/export-pattern.js.map +1 -1
  209. package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
  210. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
  211. package/build-module/dataviews/actions/reset-post.js +2 -0
  212. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  213. package/build-module/dataviews/actions/trash-post.js +2 -0
  214. package/build-module/dataviews/actions/trash-post.js.map +1 -1
  215. package/build-module/dataviews/actions/view-post.js +2 -2
  216. package/build-module/dataviews/actions/view-post.js.map +1 -1
  217. package/build-module/private-apis.js +0 -2
  218. package/build-module/private-apis.js.map +1 -1
  219. package/build-module/store/private-actions.js +1 -1
  220. package/build-module/store/private-actions.js.map +1 -1
  221. package/build-module/store/selectors.js +6 -2
  222. package/build-module/store/selectors.js.map +1 -1
  223. package/build-style/style-rtl.css +13 -8
  224. package/build-style/style.css +13 -8
  225. package/build-types/bindings/post-meta.d.ts +0 -3
  226. package/build-types/bindings/post-meta.d.ts.map +1 -1
  227. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
  228. package/build-types/components/editor-history/redo.d.ts.map +1 -1
  229. package/build-types/components/editor-history/undo.d.ts.map +1 -1
  230. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  231. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  232. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  233. package/build-types/components/header/back-button.d.ts.map +1 -1
  234. package/build-types/components/index.d.ts +1 -0
  235. package/build-types/components/index.d.ts.map +1 -1
  236. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  237. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  238. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  239. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  240. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  241. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  242. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  243. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  244. package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
  245. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
  246. package/build-types/components/post-actions/index.d.ts.map +1 -1
  247. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  248. package/build-types/components/post-format/index.d.ts.map +1 -1
  249. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  250. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  251. package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
  252. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
  253. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
  254. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  255. package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
  256. package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
  257. package/build-types/components/post-status/index.d.ts.map +1 -1
  258. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  259. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
  260. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  261. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  262. package/build-types/components/post-trash/check.d.ts.map +1 -1
  263. package/build-types/components/post-trash/index.d.ts +4 -1
  264. package/build-types/components/post-trash/index.d.ts.map +1 -1
  265. package/build-types/components/post-url/index.d.ts.map +1 -1
  266. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  267. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  268. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  269. package/build-types/components/provider/index.d.ts.map +1 -1
  270. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  271. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  272. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  273. package/build-types/components/start-page-options/index.d.ts +1 -0
  274. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  275. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  276. package/build-types/components/text-editor/index.d.ts.map +1 -1
  277. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  278. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  279. package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
  280. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
  281. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  282. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
  283. package/build-types/private-apis.d.ts.map +1 -1
  284. package/build-types/store/private-actions.d.ts.map +1 -1
  285. package/build-types/store/selectors.d.ts +8 -8
  286. package/build-types/store/selectors.d.ts.map +1 -1
  287. package/package.json +36 -36
  288. package/src/bindings/post-meta.js +12 -6
  289. package/src/components/block-manager/index.js +2 -0
  290. package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
  291. package/src/components/create-template-part-modal/style.scss +1 -1
  292. package/src/components/document-bar/index.js +4 -4
  293. package/src/components/document-outline/style.scss +1 -1
  294. package/src/components/editor/index.js +1 -1
  295. package/src/components/editor-history/redo.js +2 -0
  296. package/src/components/editor-history/undo.js +2 -0
  297. package/src/components/editor-interface/index.js +2 -4
  298. package/src/components/error-boundary/index.js +6 -1
  299. package/src/components/global-styles-provider/index.js +11 -7
  300. package/src/components/header/index.js +3 -3
  301. package/src/components/header/style.scss +6 -3
  302. package/src/components/index.js +1 -0
  303. package/src/components/inserter-sidebar/index.js +6 -8
  304. package/src/components/local-autosave-monitor/index.js +6 -6
  305. package/src/components/page-attributes/parent.js +5 -4
  306. package/src/components/plugin-preview-menu-item/index.js +52 -0
  307. package/src/components/post-actions/index.js +8 -14
  308. package/src/components/post-card-panel/style.scss +1 -1
  309. package/src/components/post-excerpt/panel.js +2 -0
  310. package/src/components/post-featured-image/index.js +6 -0
  311. package/src/components/post-featured-image/style.scss +1 -2
  312. package/src/components/post-format/index.js +2 -0
  313. package/src/components/post-last-revision/index.js +2 -0
  314. package/src/components/post-locked-modal/index.js +14 -2
  315. package/src/components/post-locked-modal/style.scss +1 -1
  316. package/src/components/post-publish-panel/index.js +2 -0
  317. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
  318. package/src/components/post-publish-panel/maybe-upload-media.js +145 -36
  319. package/src/components/post-publish-panel/media-util.js +87 -0
  320. package/src/components/post-publish-panel/style.scss +3 -1
  321. package/src/components/post-publish-panel/test/media-util.js +118 -0
  322. package/src/components/post-status/index.js +3 -2
  323. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
  324. package/src/components/post-taxonomies/most-used-terms.js +2 -0
  325. package/src/components/post-template/block-theme.js +15 -9
  326. package/src/components/post-template/classic-theme.js +2 -0
  327. package/src/components/post-title/index.js +30 -41
  328. package/src/components/post-trash/check.js +5 -2
  329. package/src/components/post-trash/index.js +23 -12
  330. package/src/components/post-url/index.js +2 -0
  331. package/src/components/preferences-modal/index.js +227 -172
  332. package/src/components/preview-dropdown/index.js +28 -20
  333. package/src/components/provider/index.js +42 -10
  334. package/src/components/provider/use-block-editor-settings.js +16 -11
  335. package/src/components/resizable-editor/style.scss +2 -2
  336. package/src/components/save-publish-panels/index.js +4 -0
  337. package/src/components/sidebar/post-summary.js +4 -0
  338. package/src/components/start-page-options/index.js +28 -26
  339. package/src/components/start-template-options/index.js +5 -1
  340. package/src/components/table-of-contents/index.js +1 -0
  341. package/src/components/text-editor/index.js +1 -0
  342. package/src/components/text-editor/style.scss +1 -1
  343. package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
  344. package/src/components/visual-editor/index.js +2 -9
  345. package/src/dataviews/actions/export-pattern.tsx +2 -0
  346. package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
  347. package/src/dataviews/actions/reset-post.tsx +2 -0
  348. package/src/dataviews/actions/trash-post.tsx +2 -0
  349. package/src/dataviews/actions/view-post.tsx +2 -2
  350. package/src/private-apis.js +0 -2
  351. package/src/store/private-actions.js +3 -1
  352. package/src/store/selectors.js +9 -3
  353. package/tsconfig.json +1 -0
  354. package/tsconfig.tsbuildinfo +1 -1
@@ -17,7 +17,7 @@ import { isBlobURL } from '@wordpress/blob';
17
17
  /**
18
18
  * Internal dependencies
19
19
  */
20
- import { store as editorStore } from '../../store';
20
+ import { fetchMedia } from './media-util';
21
21
 
22
22
  function flattenBlocks( blocks ) {
23
23
  const result = [];
@@ -30,7 +30,53 @@ function flattenBlocks( blocks ) {
30
30
  return result;
31
31
  }
32
32
 
33
- function Image( block ) {
33
+ /**
34
+ * Determine whether a block has external media.
35
+ *
36
+ * Different blocks use different attribute names (and potentially
37
+ * different logic as well) in determining whether the media is
38
+ * present, and whether it's external.
39
+ *
40
+ * @param {{name: string, attributes: Object}} block The block.
41
+ * @return {boolean?} Whether the block has external media
42
+ */
43
+ function hasExternalMedia( block ) {
44
+ if ( block.name === 'core/image' || block.name === 'core/cover' ) {
45
+ return block.attributes.url && ! block.attributes.id;
46
+ }
47
+
48
+ if ( block.name === 'core/media-text' ) {
49
+ return block.attributes.mediaUrl && ! block.attributes.mediaId;
50
+ }
51
+
52
+ return undefined;
53
+ }
54
+
55
+ /**
56
+ * Retrieve media info from a block.
57
+ *
58
+ * Different blocks use different attribute names, so we need this
59
+ * function to normalize things into a consistent naming scheme.
60
+ *
61
+ * @param {{name: string, attributes: Object}} block The block.
62
+ * @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block.
63
+ */
64
+ function getMediaInfo( block ) {
65
+ if ( block.name === 'core/image' || block.name === 'core/cover' ) {
66
+ const { url, alt, id } = block.attributes;
67
+ return { url, alt, id };
68
+ }
69
+
70
+ if ( block.name === 'core/media-text' ) {
71
+ const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes;
72
+ return { url, alt, id };
73
+ }
74
+
75
+ return {};
76
+ }
77
+
78
+ // Image component to represent a single image in the upload dialog.
79
+ function Image( { clientId, alt, url } ) {
34
80
  const { selectBlock } = useDispatch( blockEditorStore );
35
81
  return (
36
82
  <motion.img
@@ -38,17 +84,17 @@ function Image( block ) {
38
84
  role="button"
39
85
  aria-label={ __( 'Select image block.' ) }
40
86
  onClick={ () => {
41
- selectBlock( block.clientId );
87
+ selectBlock( clientId );
42
88
  } }
43
89
  onKeyDown={ ( event ) => {
44
90
  if ( event.key === 'Enter' || event.key === ' ' ) {
45
- selectBlock( block.clientId );
91
+ selectBlock( clientId );
46
92
  event.preventDefault();
47
93
  }
48
94
  } }
49
- key={ block.clientId }
50
- alt={ block.attributes.alt }
51
- src={ block.attributes.url }
95
+ key={ clientId }
96
+ alt={ alt }
97
+ src={ url }
52
98
  animate={ { opacity: 1 } }
53
99
  exit={ { opacity: 0, scale: 0 } }
54
100
  style={ {
@@ -63,24 +109,25 @@ function Image( block ) {
63
109
  );
64
110
  }
65
111
 
66
- export default function PostFormatPanel() {
112
+ export default function MaybeUploadMediaPanel() {
67
113
  const [ isUploading, setIsUploading ] = useState( false );
114
+ const [ isAnimating, setIsAnimating ] = useState( false );
115
+ const [ hadUploadError, setHadUploadError ] = useState( false );
68
116
  const { editorBlocks, mediaUpload } = useSelect(
69
117
  ( select ) => ( {
70
- editorBlocks: select( editorStore ).getEditorBlocks(),
118
+ editorBlocks: select( blockEditorStore ).getBlocks(),
71
119
  mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
72
120
  } ),
73
121
  []
74
122
  );
75
- const externalImages = flattenBlocks( editorBlocks ).filter(
76
- ( block ) =>
77
- block.name === 'core/image' &&
78
- block.attributes.url &&
79
- ! block.attributes.id
123
+
124
+ // Get a list of blocks with external media.
125
+ const blocksWithExternalMedia = flattenBlocks( editorBlocks ).filter(
126
+ ( block ) => hasExternalMedia( block )
80
127
  );
81
128
  const { updateBlockAttributes } = useDispatch( blockEditorStore );
82
129
 
83
- if ( ! mediaUpload || ! externalImages.length ) {
130
+ if ( ! mediaUpload || ! blocksWithExternalMedia.length ) {
84
131
  return null;
85
132
  }
86
133
 
@@ -91,18 +138,51 @@ export default function PostFormatPanel() {
91
138
  </span>,
92
139
  ];
93
140
 
141
+ /**
142
+ * Update an individual block to point to newly-added library media.
143
+ *
144
+ * Different blocks use different attribute names, so we need this
145
+ * function to ensure we modify the correct attributes for each type.
146
+ *
147
+ * @param {{name: string, attributes: Object}} block The block.
148
+ * @param {{id: number, url: string}} media Media library file info.
149
+ */
150
+ function updateBlockWithUploadedMedia( block, media ) {
151
+ if ( block.name === 'core/image' || block.name === 'core/cover' ) {
152
+ updateBlockAttributes( block.clientId, {
153
+ id: media.id,
154
+ url: media.url,
155
+ } );
156
+ }
157
+
158
+ if ( block.name === 'core/media-text' ) {
159
+ updateBlockAttributes( block.clientId, {
160
+ mediaId: media.id,
161
+ mediaUrl: media.url,
162
+ } );
163
+ }
164
+ }
165
+
166
+ // Handle fetching and uploading all external media in the post.
94
167
  function uploadImages() {
95
168
  setIsUploading( true );
96
- Promise.all(
97
- externalImages.map( ( image ) =>
98
- window
99
- .fetch(
100
- image.attributes.url.includes( '?' )
101
- ? image.attributes.url
102
- : image.attributes.url + '?'
103
- )
104
- .then( ( response ) => response.blob() )
105
- .then(
169
+ setHadUploadError( false );
170
+
171
+ // Multiple blocks can be using the same URL, so we
172
+ // should ensure we only fetch and upload each of them once.
173
+ const mediaUrls = new Set(
174
+ blocksWithExternalMedia.map( ( block ) => {
175
+ const { url } = getMediaInfo( block );
176
+ return url;
177
+ } )
178
+ );
179
+
180
+ // Create an upload promise for each URL, that we can wait for in all
181
+ // blocks that make use of that media.
182
+ const uploadPromises = Object.fromEntries(
183
+ Object.entries( fetchMedia( [ ...mediaUrls ] ) ).map(
184
+ ( [ url, filePromise ] ) => {
185
+ const uploadPromise = filePromise.then(
106
186
  ( blob ) =>
107
187
  new Promise( ( resolve, reject ) => {
108
188
  mediaUpload( {
@@ -112,19 +192,32 @@ export default function PostFormatPanel() {
112
192
  return;
113
193
  }
114
194
 
115
- updateBlockAttributes( image.clientId, {
116
- id: media.id,
117
- url: media.url,
118
- } );
119
- resolve();
195
+ resolve( media );
120
196
  },
121
197
  onError() {
122
198
  reject();
123
199
  },
124
200
  } );
125
201
  } )
126
- )
202
+ );
203
+
204
+ return [ url, uploadPromise ];
205
+ }
127
206
  )
207
+ );
208
+
209
+ // Wait for all blocks to be updated with library media.
210
+ Promise.allSettled(
211
+ blocksWithExternalMedia.map( ( block ) => {
212
+ const { url } = getMediaInfo( block );
213
+
214
+ return uploadPromises[ url ]
215
+ .then( ( media ) =>
216
+ updateBlockWithUploadedMedia( block, media )
217
+ )
218
+ .then( () => setIsAnimating( true ) )
219
+ .catch( () => setHadUploadError( true ) );
220
+ } )
128
221
  ).finally( () => {
129
222
  setIsUploading( false );
130
223
  } );
@@ -144,19 +237,35 @@ export default function PostFormatPanel() {
144
237
  gap: '8px',
145
238
  } }
146
239
  >
147
- <AnimatePresence>
148
- { externalImages.map( ( image ) => {
149
- return <Image key={ image.clientId } { ...image } />;
240
+ <AnimatePresence
241
+ onExitComplete={ () => setIsAnimating( false ) }
242
+ >
243
+ { blocksWithExternalMedia.map( ( block ) => {
244
+ const { url, alt } = getMediaInfo( block );
245
+ return (
246
+ <Image
247
+ key={ block.clientId }
248
+ clientId={ block.clientId }
249
+ url={ url }
250
+ alt={ alt }
251
+ />
252
+ );
150
253
  } ) }
151
254
  </AnimatePresence>
152
- { isUploading ? (
255
+ { isUploading || isAnimating ? (
153
256
  <Spinner />
154
257
  ) : (
155
- <Button variant="primary" onClick={ uploadImages }>
258
+ <Button
259
+ // TODO: Switch to `true` (40px size) if possible
260
+ __next40pxDefaultSize={ false }
261
+ variant="primary"
262
+ onClick={ uploadImages }
263
+ >
156
264
  { __( 'Upload' ) }
157
265
  </Button>
158
266
  ) }
159
267
  </div>
268
+ { hadUploadError && <p>{ __( 'Upload failed, try again.' ) }</p> }
160
269
  </PanelBody>
161
270
  );
162
271
  }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { v4 as uuid } from 'uuid';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { getFilename } from '@wordpress/url';
10
+
11
+ /**
12
+ * Generate a list of unique basenames given a list of URLs.
13
+ *
14
+ * We want all basenames to be unique, since sometimes the extension
15
+ * doesn't reflect the mime type, and may end up getting changed by
16
+ * the server, on upload.
17
+ *
18
+ * @param {string[]} urls The list of URLs
19
+ * @return {Record< string, string >} A URL => basename record.
20
+ */
21
+ export function generateUniqueBasenames( urls ) {
22
+ const basenames = new Set();
23
+
24
+ return Object.fromEntries(
25
+ urls.map( ( url ) => {
26
+ // We prefer to match the remote filename, if possible.
27
+ const filename = getFilename( url );
28
+ let basename = '';
29
+
30
+ if ( filename ) {
31
+ const parts = filename.split( '.' );
32
+ if ( parts.length > 1 ) {
33
+ // Assume the last part is the extension.
34
+ parts.pop();
35
+ }
36
+ basename = parts.join( '.' );
37
+ }
38
+
39
+ if ( ! basename ) {
40
+ // It looks like we don't have a basename, so let's use a UUID.
41
+ basename = uuid();
42
+ }
43
+
44
+ if ( basenames.has( basename ) ) {
45
+ // Append a UUID to deduplicate the basename.
46
+ // The server will try to deduplicate on its own if we don't do this,
47
+ // but it may run into a race condition
48
+ // (see https://github.com/WordPress/gutenberg/issues/64899).
49
+ // Deduplicating the filenames before uploading is safer.
50
+ basename = `${ basename }-${ uuid() }`;
51
+ }
52
+
53
+ basenames.add( basename );
54
+
55
+ return [ url, basename ];
56
+ } )
57
+ );
58
+ }
59
+
60
+ /**
61
+ * Fetch a list of URLs, turning those into promises for files with
62
+ * unique filenames.
63
+ *
64
+ * @param {string[]} urls The list of URLs
65
+ * @return {Record< string, Promise< File > >} A URL => File promise record.
66
+ */
67
+ export function fetchMedia( urls ) {
68
+ return Object.fromEntries(
69
+ Object.entries( generateUniqueBasenames( urls ) ).map(
70
+ ( [ url, basename ] ) => {
71
+ const filePromise = window
72
+ .fetch( url.includes( '?' ) ? url : url + '?' )
73
+ .then( ( response ) => response.blob() )
74
+ .then( ( blob ) => {
75
+ // The server will reject the upload if it doesn't have an extension,
76
+ // even though it'll rewrite the file name to match the mime type.
77
+ // Here we provide it with a safe extension to get it past that check.
78
+ return new File( [ blob ], `${ basename }.png`, {
79
+ type: blob.type,
80
+ } );
81
+ } );
82
+
83
+ return [ url, filePromise ];
84
+ }
85
+ )
86
+ );
87
+ }
@@ -37,8 +37,9 @@
37
37
 
38
38
  .components-site-icon {
39
39
  border: none;
40
- border-radius: $radius-block-ui;
40
+ border-radius: $radius-small;
41
41
  margin-right: $grid-unit-15;
42
+ flex-shrink: 0;
42
43
 
43
44
  // Same size as in the Site menu.
44
45
  height: 36px;
@@ -54,6 +55,7 @@
54
55
  display: block;
55
56
  color: $gray-700;
56
57
  font-size: $helptext-font-size;
58
+ word-break: break-word;
57
59
  }
58
60
 
59
61
  .editor-post-publish-panel__header-publish-button,
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { generateUniqueBasenames } from '../media-util';
5
+
6
+ describe( 'generateUniqueBasenames', () => {
7
+ it( 'should prefer the original basenames', () => {
8
+ const urls = [
9
+ 'https://example.com/images/image1.jpg',
10
+ 'https://example.com/images/image2.jpg',
11
+ 'https://example.com/images/image3.jpg',
12
+ 'https://example.com/images/image4.jpg',
13
+ ];
14
+
15
+ expect( generateUniqueBasenames( urls ) ).toEqual( {
16
+ 'https://example.com/images/image1.jpg': 'image1',
17
+ 'https://example.com/images/image2.jpg': 'image2',
18
+ 'https://example.com/images/image3.jpg': 'image3',
19
+ 'https://example.com/images/image4.jpg': 'image4',
20
+ } );
21
+ } );
22
+
23
+ it( 'should handle filenames with no extensions', () => {
24
+ const urls = [
25
+ 'https://example.com/images/image1',
26
+ 'https://example.com/images/image2',
27
+ 'https://example.com/images/image3',
28
+ 'https://example.com/images/image4',
29
+ ];
30
+
31
+ expect( generateUniqueBasenames( urls ) ).toEqual( {
32
+ 'https://example.com/images/image1': 'image1',
33
+ 'https://example.com/images/image2': 'image2',
34
+ 'https://example.com/images/image3': 'image3',
35
+ 'https://example.com/images/image4': 'image4',
36
+ } );
37
+ } );
38
+
39
+ it( 'should handle query parameters correctly', () => {
40
+ const urls = [
41
+ 'https://example.com/images/image1.jpg?a=notafile.npg',
42
+ 'https://example.com/images/image2.jpg?a=notafile.npg',
43
+ 'https://example.com/images/image3.jpg?a=notafile.npg',
44
+ 'https://example.com/images/image4.jpg?a=notafile.npg',
45
+ ];
46
+
47
+ expect( generateUniqueBasenames( urls ) ).toEqual( {
48
+ 'https://example.com/images/image1.jpg?a=notafile.npg': 'image1',
49
+ 'https://example.com/images/image2.jpg?a=notafile.npg': 'image2',
50
+ 'https://example.com/images/image3.jpg?a=notafile.npg': 'image3',
51
+ 'https://example.com/images/image4.jpg?a=notafile.npg': 'image4',
52
+ } );
53
+ } );
54
+
55
+ it( 'should deduplicate identical filenames', () => {
56
+ const urls = [
57
+ 'https://example.com/image1/image.jpg',
58
+ 'https://example.com/image2/image.jpg',
59
+ 'https://example.com/image3/image.jpg',
60
+ 'https://example.com/image4/image.jpg',
61
+ ];
62
+
63
+ const results = generateUniqueBasenames( urls );
64
+ const resultLength = Object.entries( results ).length;
65
+ expect( resultLength ).toBe( urls.length );
66
+
67
+ const basenames = new Set( Object.values( results ) );
68
+ expect( basenames.size ).toBe( resultLength );
69
+ } );
70
+
71
+ it( 'should deduplicate identical basenames', () => {
72
+ const urls = [
73
+ 'https://example.com/images/image.jpg',
74
+ 'https://example.com/images/image.png',
75
+ 'https://example.com/images/image.webp',
76
+ 'https://example.com/images/image.avif',
77
+ ];
78
+
79
+ const results = generateUniqueBasenames( urls );
80
+ const resultLength = Object.entries( results ).length;
81
+ expect( resultLength ).toBe( urls.length );
82
+
83
+ const basenames = new Set( Object.values( results ) );
84
+ expect( basenames.size ).toBe( resultLength );
85
+ } );
86
+
87
+ it( 'should deduplicate filenames without extensions', () => {
88
+ const urls = [
89
+ 'https://example.com/image1/image',
90
+ 'https://example.com/image2/image',
91
+ 'https://example.com/image3/image',
92
+ 'https://example.com/image4/image',
93
+ ];
94
+
95
+ const results = generateUniqueBasenames( urls );
96
+ const resultLength = Object.entries( results ).length;
97
+ expect( resultLength ).toBe( urls.length );
98
+
99
+ const basenames = new Set( Object.values( results ) );
100
+ expect( basenames.size ).toBe( resultLength );
101
+ } );
102
+
103
+ it( 'should deduplicate paths with no filename', () => {
104
+ const urls = [
105
+ 'https://example.com/image1/dir/',
106
+ 'https://example.com/image2/dir/',
107
+ 'https://example.com/image3/dir/',
108
+ 'https://example.com/image4/dir/',
109
+ ];
110
+
111
+ const results = generateUniqueBasenames( urls );
112
+ const resultLength = Object.entries( results ).length;
113
+ expect( resultLength ).toBe( urls.length );
114
+
115
+ const basenames = new Set( Object.values( results ) );
116
+ expect( basenames.size ).toBe( resultLength );
117
+ } );
118
+ } );
@@ -171,7 +171,7 @@ export default function PostStatus() {
171
171
  contentClassName="editor-change-status__content"
172
172
  popoverProps={ popoverProps }
173
173
  focusOnMount
174
- renderToggle={ ( { onToggle } ) => (
174
+ renderToggle={ ( { onToggle, isOpen } ) => (
175
175
  <Button
176
176
  variant="tertiary"
177
177
  size="compact"
@@ -179,9 +179,10 @@ export default function PostStatus() {
179
179
  icon={ postStatusesInfo[ status ]?.icon }
180
180
  aria-label={ sprintf(
181
181
  // translators: %s: Current post status.
182
- __( 'Change post status: %s' ),
182
+ __( 'Change status: %s' ),
183
183
  postStatusesInfo[ status ]?.label
184
184
  ) }
185
+ aria-expanded={ isOpen }
185
186
  >
186
187
  { postStatusesInfo[ status ]?.label }
187
188
  </Button>
@@ -428,6 +428,8 @@ export function HierarchicalTermSelector( { slug } ) {
428
428
  { ! loading && hasCreateAction && (
429
429
  <FlexItem>
430
430
  <Button
431
+ // TODO: Switch to `true` (40px size) if possible
432
+ __next40pxDefaultSize={ false }
431
433
  onClick={ onToggleForm }
432
434
  className="editor-post-taxonomies__hierarchical-terms-add"
433
435
  aria-expanded={ showForm }
@@ -62,6 +62,8 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
62
62
  { terms.map( ( term ) => (
63
63
  <li key={ term.id }>
64
64
  <Button
65
+ // TODO: Switch to `true` (40px size) if possible
66
+ __next40pxDefaultSize={ false }
65
67
  variant="link"
66
68
  onClick={ () => onSelect( term ) }
67
69
  >
@@ -8,6 +8,7 @@ import { __ } from '@wordpress/i18n';
8
8
  import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
9
9
  import { check } from '@wordpress/icons';
10
10
  import { store as noticesStore } from '@wordpress/notices';
11
+ import { store as preferencesStore } from '@wordpress/preferences';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
@@ -43,6 +44,8 @@ export default function BlockThemeControl( { id } ) {
43
44
  };
44
45
  }, [] );
45
46
 
47
+ const { get: getPreference } = useSelect( preferencesStore );
48
+
46
49
  const { editedRecord: template, hasResolved } = useEntityRecord(
47
50
  'postType',
48
51
  'wp_template',
@@ -75,6 +78,17 @@ export default function BlockThemeControl( { id } ) {
75
78
  },
76
79
  ]
77
80
  : undefined;
81
+
82
+ const mayShowTemplateEditNotice = () => {
83
+ if ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {
84
+ createSuccessNotice(
85
+ __(
86
+ 'Editing template. Changes made here affect all posts and pages that use the template.'
87
+ ),
88
+ { type: 'snackbar', actions: notificationAction }
89
+ );
90
+ }
91
+ };
78
92
  return (
79
93
  <DropdownMenu
80
94
  popoverProps={ POPOVER_PROPS }
@@ -99,15 +113,7 @@ export default function BlockThemeControl( { id } ) {
99
113
  postType: 'wp_template',
100
114
  } );
101
115
  onClose();
102
- createSuccessNotice(
103
- __(
104
- 'Editing template. Changes made here affect all posts and pages that use the template.'
105
- ),
106
- {
107
- type: 'snackbar',
108
- actions: notificationAction,
109
- }
110
- );
116
+ mayShowTemplateEditNotice();
111
117
  } }
112
118
  >
113
119
  { __( 'Edit template' ) }
@@ -177,6 +177,8 @@ function PostTemplateDropdownContent( { onClose } ) {
177
177
  { canEdit && onNavigateToEntityRecord && (
178
178
  <p>
179
179
  <Button
180
+ // TODO: Switch to `true` (40px size) if possible
181
+ __next40pxDefaultSize={ false }
180
182
  variant="link"
181
183
  onClick={ () => {
182
184
  onNavigateToEntityRecord( {
@@ -15,7 +15,6 @@ import { pasteHandler } from '@wordpress/blocks';
15
15
  import {
16
16
  __unstableUseRichText as useRichText,
17
17
  create,
18
- toHTMLString,
19
18
  insert,
20
19
  } from '@wordpress/rich-text';
21
20
  import { useMergeRefs } from '@wordpress/compose';
@@ -50,9 +49,35 @@ function PostTitle( _, forwardedRef ) {
50
49
  const { clearSelectedBlock, insertBlocks, insertDefaultBlock } =
51
50
  useDispatch( blockEditorStore );
52
51
 
53
- function onChange( value ) {
54
- onUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );
55
- }
52
+ const decodedPlaceholder =
53
+ decodeEntities( placeholder ) || __( 'Add title' );
54
+
55
+ const {
56
+ value,
57
+ onChange,
58
+ ref: richTextRef,
59
+ } = useRichText( {
60
+ value: title,
61
+ onChange( newValue ) {
62
+ onUpdate( newValue.replace( REGEXP_NEWLINES, ' ' ) );
63
+ },
64
+ placeholder: decodedPlaceholder,
65
+ selectionStart: selection.start,
66
+ selectionEnd: selection.end,
67
+ onSelectionChange( newStart, newEnd ) {
68
+ setSelection( ( sel ) => {
69
+ const { start, end } = sel;
70
+ if ( start === newStart && end === newEnd ) {
71
+ return sel;
72
+ }
73
+ return {
74
+ start: newStart,
75
+ end: newEnd,
76
+ };
77
+ } );
78
+ },
79
+ __unstableDisableFormats: false,
80
+ } );
56
81
 
57
82
  function onInsertBlockAfter( blocks ) {
58
83
  insertBlocks( blocks, 0 );
@@ -130,49 +155,14 @@ function PostTitle( _, forwardedRef ) {
130
155
  onInsertBlockAfter( content );
131
156
  }
132
157
  } else {
133
- const value = {
134
- ...create( { html: title } ),
135
- ...selection,
136
- };
137
-
138
158
  // Strip HTML to avoid unwanted HTML being added to the title.
139
159
  // In the majority of cases it is assumed that HTML in the title
140
160
  // is undesirable.
141
161
  const contentNoHTML = stripHTML( content );
142
-
143
- const newValue = insert( value, create( { html: contentNoHTML } ) );
144
- onUpdate( toHTMLString( { value: newValue } ) );
145
- setSelection( {
146
- start: newValue.start,
147
- end: newValue.end,
148
- } );
162
+ onChange( insert( value, create( { html: contentNoHTML } ) ) );
149
163
  }
150
164
  }
151
165
 
152
- const decodedPlaceholder =
153
- decodeEntities( placeholder ) || __( 'Add title' );
154
-
155
- const { ref: richTextRef } = useRichText( {
156
- value: title,
157
- onChange,
158
- placeholder: decodedPlaceholder,
159
- selectionStart: selection.start,
160
- selectionEnd: selection.end,
161
- onSelectionChange( newStart, newEnd ) {
162
- setSelection( ( sel ) => {
163
- const { start, end } = sel;
164
- if ( start === newStart && end === newEnd ) {
165
- return sel;
166
- }
167
- return {
168
- start: newStart,
169
- end: newEnd,
170
- };
171
- } );
172
- },
173
- __unstableDisableFormats: false,
174
- } );
175
-
176
166
  // The wp-block className is important for editor styles.
177
167
  // This same block is used in both the visual and the code editor.
178
168
  const className = clsx( DEFAULT_CLASSNAMES, {
@@ -192,7 +182,6 @@ function PostTitle( _, forwardedRef ) {
192
182
  onFocus={ onSelect }
193
183
  onBlur={ onUnselect }
194
184
  onKeyDown={ onKeyDown }
195
- onKeyPress={ onUnselect }
196
185
  onPaste={ onPaste }
197
186
  />
198
187
  </PostTypeSupportCheck>