@wordpress/editor 14.48.0 → 14.48.2-next.v.202606191442.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 (509) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/build/bindings/pattern-overrides.cjs +1 -1
  3. package/build/bindings/pattern-overrides.cjs.map +2 -2
  4. package/build/components/block-removal-warnings/index.cjs +0 -3
  5. package/build/components/block-removal-warnings/index.cjs.map +2 -2
  6. package/build/components/collab-sidebar/note-byline.cjs +1 -1
  7. package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
  8. package/build/components/collab-sidebar/note-indicator-toolbar.cjs +49 -43
  9. package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +3 -3
  10. package/build/components/collab-sidebar/note.cjs +49 -17
  11. package/build/components/collab-sidebar/note.cjs.map +3 -3
  12. package/build/components/collab-sidebar/notes.cjs.map +1 -1
  13. package/build/components/collab-sidebar/utils.cjs +1 -1
  14. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  15. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +1 -1
  16. package/build/components/collaborators-overlay/collaborator-styles.cjs.map +1 -1
  17. package/build/components/collaborators-overlay/compute-selection.cjs.map +1 -1
  18. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
  19. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +1 -1
  20. package/build/components/collaborators-overlay/use-block-highlighting.cjs +1 -8
  21. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
  22. package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -7
  23. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
  24. package/build/components/collaborators-presence/avatar/component.cjs.map +2 -2
  25. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +1 -1
  26. package/build/components/document-bar/index.cjs +7 -5
  27. package/build/components/document-bar/index.cjs.map +2 -2
  28. package/build/components/global-keyboard-shortcuts/index.cjs +3 -2
  29. package/build/components/global-keyboard-shortcuts/index.cjs.map +2 -2
  30. package/build/components/global-styles-sidebar/welcome-guide.cjs +3 -3
  31. package/build/components/global-styles-sidebar/welcome-guide.cjs.map +1 -1
  32. package/build/components/local-autosave-monitor/index.cjs +14 -15
  33. package/build/components/local-autosave-monitor/index.cjs.map +2 -2
  34. package/build/components/more-menu/view-more-menu-group.cjs +1 -2
  35. package/build/components/more-menu/view-more-menu-group.cjs.map +2 -2
  36. package/build/components/page-attributes/parent.cjs +2 -1
  37. package/build/components/page-attributes/parent.cjs.map +2 -2
  38. package/build/components/post-card-panel/index.cjs +1 -1
  39. package/build/components/post-card-panel/index.cjs.map +2 -2
  40. package/build/components/post-excerpt/panel.cjs +1 -1
  41. package/build/components/post-excerpt/panel.cjs.map +2 -2
  42. package/build/components/post-locked-modal/index.cjs +3 -3
  43. package/build/components/post-locked-modal/index.cjs.map +1 -1
  44. package/build/components/post-preview-button/index.cjs +2 -2
  45. package/build/components/post-preview-button/index.cjs.map +2 -2
  46. package/build/components/post-publish-button/index.cjs +115 -157
  47. package/build/components/post-publish-button/index.cjs.map +3 -3
  48. package/build/components/post-publish-button/label.cjs +2 -2
  49. package/build/components/post-publish-button/label.cjs.map +2 -2
  50. package/build/components/post-publish-panel/index.cjs.map +1 -1
  51. package/build/components/post-publish-panel/postpublish.cjs +1 -1
  52. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  53. package/build/components/post-revisions-preview/block-diff.cjs +21 -9
  54. package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
  55. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  56. package/build/components/post-revisions-preview/preserve-client-ids.cjs +2 -2
  57. package/build/components/post-revisions-preview/preserve-client-ids.cjs.map +2 -2
  58. package/build/components/post-revisions-preview/revisions-slider.cjs +1 -1
  59. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  60. package/build/components/post-revisions-timeline/index.cjs +173 -0
  61. package/build/components/post-revisions-timeline/index.cjs.map +7 -0
  62. package/build/components/post-saved-state/index.cjs +17 -26
  63. package/build/components/post-saved-state/index.cjs.map +2 -2
  64. package/build/components/post-schedule/label.cjs +5 -5
  65. package/build/components/post-schedule/label.cjs.map +1 -1
  66. package/build/components/post-taxonomies/flat-term-selector.cjs +2 -1
  67. package/build/components/post-taxonomies/flat-term-selector.cjs.map +3 -3
  68. package/build/components/post-taxonomies/hierarchical-term-selector.cjs +1 -1
  69. package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
  70. package/build/components/post-text-editor/index.cjs +51 -0
  71. package/build/components/post-text-editor/index.cjs.map +2 -2
  72. package/build/components/post-text-editor/utils.cjs +150 -0
  73. package/build/components/post-text-editor/utils.cjs.map +7 -0
  74. package/build/components/post-url/index.cjs +1 -1
  75. package/build/components/post-url/index.cjs.map +2 -2
  76. package/build/components/post-view-link/index.cjs +1 -1
  77. package/build/components/post-view-link/index.cjs.map +2 -2
  78. package/build/components/provider/disable-non-page-content-blocks.cjs.map +1 -1
  79. package/build/components/provider/index.cjs +3 -1
  80. package/build/components/provider/index.cjs.map +3 -3
  81. package/build/components/provider/use-network-reconnect.cjs +51 -0
  82. package/build/components/provider/use-network-reconnect.cjs.map +7 -0
  83. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  84. package/build/components/revision-diff-panel/index.cjs +7 -2
  85. package/build/components/revision-diff-panel/index.cjs.map +2 -2
  86. package/build/components/revision-fields-diff/index.cjs +8 -4
  87. package/build/components/revision-fields-diff/index.cjs.map +2 -2
  88. package/build/components/sidebar/dataform-post-summary.cjs +125 -20
  89. package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
  90. package/build/components/sidebar/index.cjs +2 -15
  91. package/build/components/sidebar/index.cjs.map +3 -3
  92. package/build/components/sidebar/post-revision-summary.cjs +11 -17
  93. package/build/components/sidebar/post-revision-summary.cjs.map +3 -3
  94. package/build/components/sidebar/post-summary.cjs +1 -1
  95. package/build/components/sidebar/post-summary.cjs.map +2 -2
  96. package/build/components/style-book/examples.cjs +1 -1
  97. package/build/components/style-book/examples.cjs.map +1 -1
  98. package/build/components/style-book/index.cjs +1 -1
  99. package/build/components/style-book/index.cjs.map +2 -2
  100. package/build/components/sync-connection-error-modal/index.cjs +3 -3
  101. package/build/components/sync-connection-error-modal/index.cjs.map +1 -1
  102. package/build/components/template-actions-panel/block-theme-content.cjs +7 -1
  103. package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
  104. package/build/components/template-actions-panel/index.cjs +0 -9
  105. package/build/components/template-actions-panel/index.cjs.map +3 -3
  106. package/build/components/template-validation-notice/index.cjs +1 -1
  107. package/build/components/template-validation-notice/index.cjs.map +1 -1
  108. package/build/components/upload-progress-snackbar/index.cjs +161 -0
  109. package/build/components/upload-progress-snackbar/index.cjs.map +7 -0
  110. package/build/components/upload-progress-snackbar/tracker.cjs +90 -0
  111. package/build/components/upload-progress-snackbar/tracker.cjs.map +7 -0
  112. package/build/components/visual-editor/edit-template-blocks-notification.cjs +1 -1
  113. package/build/components/visual-editor/edit-template-blocks-notification.cjs.map +1 -1
  114. package/build/{components/revision-author-panel → dataviews/fields/revisions}/index.cjs +18 -26
  115. package/build/dataviews/fields/revisions/index.cjs.map +7 -0
  116. package/build/dataviews/fields/revisions/revisions-view.cjs +74 -0
  117. package/build/dataviews/fields/revisions/revisions-view.cjs.map +7 -0
  118. package/build/dataviews/store/private-actions.cjs +14 -4
  119. package/build/dataviews/store/private-actions.cjs.map +3 -3
  120. package/build/hooks/push-changes-to-global-styles/index.cjs +1 -1
  121. package/build/hooks/push-changes-to-global-styles/index.cjs.map +1 -1
  122. package/build/private-apis.cjs +2 -0
  123. package/build/private-apis.cjs.map +3 -3
  124. package/build/store/actions.cjs +1 -1
  125. package/build/store/actions.cjs.map +2 -2
  126. package/build/store/private-selectors.cjs +6 -1
  127. package/build/store/private-selectors.cjs.map +2 -2
  128. package/build/store/selectors.cjs +1 -2
  129. package/build/store/selectors.cjs.map +2 -2
  130. package/build/utils/media-upload/index.cjs +16 -0
  131. package/build/utils/media-upload/index.cjs.map +3 -3
  132. package/build/utils/set-nested-value.cjs.map +1 -1
  133. package/build-module/bindings/pattern-overrides.mjs +1 -1
  134. package/build-module/bindings/pattern-overrides.mjs.map +2 -2
  135. package/build-module/components/block-removal-warnings/index.mjs +0 -3
  136. package/build-module/components/block-removal-warnings/index.mjs.map +2 -2
  137. package/build-module/components/collab-sidebar/note-byline.mjs +1 -1
  138. package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
  139. package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs +53 -44
  140. package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +2 -2
  141. package/build-module/components/collab-sidebar/note.mjs +50 -18
  142. package/build-module/components/collab-sidebar/note.mjs.map +2 -2
  143. package/build-module/components/collab-sidebar/notes.mjs.map +1 -1
  144. package/build-module/components/collab-sidebar/utils.mjs +1 -1
  145. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  146. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +1 -1
  147. package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +1 -1
  148. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +1 -1
  149. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
  150. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +1 -1
  151. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +1 -8
  152. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
  153. package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -7
  154. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  155. package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
  156. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +1 -1
  157. package/build-module/components/document-bar/index.mjs +7 -5
  158. package/build-module/components/document-bar/index.mjs.map +2 -2
  159. package/build-module/components/global-keyboard-shortcuts/index.mjs +3 -2
  160. package/build-module/components/global-keyboard-shortcuts/index.mjs.map +2 -2
  161. package/build-module/components/global-styles-sidebar/welcome-guide.mjs +3 -3
  162. package/build-module/components/global-styles-sidebar/welcome-guide.mjs.map +1 -1
  163. package/build-module/components/local-autosave-monitor/index.mjs +15 -16
  164. package/build-module/components/local-autosave-monitor/index.mjs.map +2 -2
  165. package/build-module/components/more-menu/view-more-menu-group.mjs +1 -2
  166. package/build-module/components/more-menu/view-more-menu-group.mjs.map +2 -2
  167. package/build-module/components/page-attributes/parent.mjs +2 -1
  168. package/build-module/components/page-attributes/parent.mjs.map +2 -2
  169. package/build-module/components/post-card-panel/index.mjs +1 -1
  170. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  171. package/build-module/components/post-excerpt/panel.mjs +1 -1
  172. package/build-module/components/post-excerpt/panel.mjs.map +2 -2
  173. package/build-module/components/post-locked-modal/index.mjs +3 -3
  174. package/build-module/components/post-locked-modal/index.mjs.map +1 -1
  175. package/build-module/components/post-preview-button/index.mjs +2 -2
  176. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  177. package/build-module/components/post-publish-button/index.mjs +117 -159
  178. package/build-module/components/post-publish-button/index.mjs.map +2 -2
  179. package/build-module/components/post-publish-button/label.mjs +2 -2
  180. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  181. package/build-module/components/post-publish-panel/index.mjs.map +1 -1
  182. package/build-module/components/post-publish-panel/postpublish.mjs +1 -1
  183. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  184. package/build-module/components/post-revisions-preview/block-diff.mjs +20 -8
  185. package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
  186. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  187. package/build-module/components/post-revisions-preview/preserve-client-ids.mjs +1 -1
  188. package/build-module/components/post-revisions-preview/preserve-client-ids.mjs.map +1 -1
  189. package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -1
  190. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  191. package/build-module/components/post-revisions-timeline/index.mjs +152 -0
  192. package/build-module/components/post-revisions-timeline/index.mjs.map +7 -0
  193. package/build-module/components/post-saved-state/index.mjs +17 -26
  194. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  195. package/build-module/components/post-schedule/label.mjs +5 -5
  196. package/build-module/components/post-schedule/label.mjs.map +1 -1
  197. package/build-module/components/post-taxonomies/flat-term-selector.mjs +3 -6
  198. package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
  199. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +1 -1
  200. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
  201. package/build-module/components/post-text-editor/index.mjs +51 -0
  202. package/build-module/components/post-text-editor/index.mjs.map +2 -2
  203. package/build-module/components/post-text-editor/utils.mjs +123 -0
  204. package/build-module/components/post-text-editor/utils.mjs.map +7 -0
  205. package/build-module/components/post-url/index.mjs +1 -1
  206. package/build-module/components/post-url/index.mjs.map +2 -2
  207. package/build-module/components/post-view-link/index.mjs +1 -1
  208. package/build-module/components/post-view-link/index.mjs.map +2 -2
  209. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +1 -1
  210. package/build-module/components/provider/index.mjs +3 -1
  211. package/build-module/components/provider/index.mjs.map +2 -2
  212. package/build-module/components/provider/use-network-reconnect.mjs +30 -0
  213. package/build-module/components/provider/use-network-reconnect.mjs.map +7 -0
  214. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  215. package/build-module/components/revision-diff-panel/index.mjs +7 -2
  216. package/build-module/components/revision-diff-panel/index.mjs.map +2 -2
  217. package/build-module/components/revision-fields-diff/index.mjs +8 -4
  218. package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
  219. package/build-module/components/sidebar/dataform-post-summary.mjs +125 -20
  220. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  221. package/build-module/components/sidebar/index.mjs +3 -22
  222. package/build-module/components/sidebar/index.mjs.map +2 -2
  223. package/build-module/components/sidebar/post-revision-summary.mjs +11 -17
  224. package/build-module/components/sidebar/post-revision-summary.mjs.map +2 -2
  225. package/build-module/components/sidebar/post-summary.mjs +1 -1
  226. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  227. package/build-module/components/style-book/examples.mjs +1 -1
  228. package/build-module/components/style-book/examples.mjs.map +1 -1
  229. package/build-module/components/style-book/index.mjs +1 -1
  230. package/build-module/components/style-book/index.mjs.map +2 -2
  231. package/build-module/components/sync-connection-error-modal/index.mjs +3 -3
  232. package/build-module/components/sync-connection-error-modal/index.mjs.map +1 -1
  233. package/build-module/components/template-actions-panel/block-theme-content.mjs +7 -1
  234. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
  235. package/build-module/components/template-actions-panel/index.mjs +0 -9
  236. package/build-module/components/template-actions-panel/index.mjs.map +2 -2
  237. package/build-module/components/template-validation-notice/index.mjs +1 -1
  238. package/build-module/components/template-validation-notice/index.mjs.map +1 -1
  239. package/build-module/components/upload-progress-snackbar/index.mjs +135 -0
  240. package/build-module/components/upload-progress-snackbar/index.mjs.map +7 -0
  241. package/build-module/components/upload-progress-snackbar/tracker.mjs +61 -0
  242. package/build-module/components/upload-progress-snackbar/tracker.mjs.map +7 -0
  243. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs +1 -1
  244. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs.map +1 -1
  245. package/build-module/dataviews/fields/revisions/index.mjs +20 -0
  246. package/build-module/dataviews/fields/revisions/index.mjs.map +7 -0
  247. package/build-module/dataviews/fields/revisions/revisions-view.mjs +53 -0
  248. package/build-module/dataviews/fields/revisions/revisions-view.mjs.map +7 -0
  249. package/build-module/dataviews/store/private-actions.mjs +23 -7
  250. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  251. package/build-module/hooks/push-changes-to-global-styles/index.mjs +1 -1
  252. package/build-module/hooks/push-changes-to-global-styles/index.mjs.map +1 -1
  253. package/build-module/private-apis.mjs +2 -0
  254. package/build-module/private-apis.mjs.map +2 -2
  255. package/build-module/store/actions.mjs +1 -1
  256. package/build-module/store/actions.mjs.map +2 -2
  257. package/build-module/store/private-selectors.mjs +7 -1
  258. package/build-module/store/private-selectors.mjs.map +2 -2
  259. package/build-module/store/selectors.mjs +1 -2
  260. package/build-module/store/selectors.mjs.map +2 -2
  261. package/build-module/utils/media-upload/index.mjs +19 -0
  262. package/build-module/utils/media-upload/index.mjs.map +2 -2
  263. package/build-module/utils/set-nested-value.mjs.map +1 -1
  264. package/build-style/style-rtl.css +707 -270
  265. package/build-style/style.css +707 -270
  266. package/build-types/components/block-removal-warnings/index.d.ts.map +1 -1
  267. package/build-types/components/collab-sidebar/note-byline.d.ts +0 -3
  268. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
  269. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -1
  270. package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
  271. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +0 -3
  272. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
  273. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
  274. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
  275. package/build-types/components/document-bar/index.d.ts.map +1 -1
  276. package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
  277. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  278. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  279. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  280. package/build-types/components/post-publish-button/index.d.ts +9 -9
  281. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  282. package/build-types/components/post-revisions-preview/block-diff.d.ts +3 -0
  283. package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
  284. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  285. package/build-types/components/post-revisions-timeline/index.d.ts +2 -0
  286. package/build-types/components/post-revisions-timeline/index.d.ts.map +1 -0
  287. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  288. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  289. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  290. package/build-types/components/post-text-editor/utils.d.ts +29 -0
  291. package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
  292. package/build-types/components/provider/index.d.ts.map +1 -1
  293. package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
  294. package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
  295. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  296. package/build-types/components/revision-diff-panel/index.d.ts +3 -1
  297. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
  298. package/build-types/components/revision-fields-diff/index.d.ts +3 -0
  299. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
  300. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  301. package/build-types/components/sidebar/index.d.ts.map +1 -1
  302. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
  303. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
  304. package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
  305. package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
  306. package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
  307. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
  308. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
  309. package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
  310. package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
  311. package/build-types/dataviews/fields/revisions/index.d.ts +8 -0
  312. package/build-types/dataviews/fields/revisions/index.d.ts.map +1 -0
  313. package/build-types/dataviews/fields/revisions/revisions-view.d.ts +2 -0
  314. package/build-types/dataviews/fields/revisions/revisions-view.d.ts.map +1 -0
  315. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  316. package/build-types/private-apis.d.ts.map +1 -1
  317. package/build-types/store/private-selectors.d.ts +1 -1
  318. package/build-types/store/private-selectors.d.ts.map +1 -1
  319. package/build-types/store/selectors.d.ts +1 -1
  320. package/build-types/store/selectors.d.ts.map +1 -1
  321. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  322. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  323. package/package.json +59 -50
  324. package/src/bindings/pattern-overrides.js +1 -1
  325. package/src/bindings/test/pattern-overrides.js +65 -0
  326. package/src/components/README.md +1 -1
  327. package/src/components/block-removal-warnings/index.js +0 -7
  328. package/src/components/collab-sidebar/note-byline.js +0 -1
  329. package/src/components/collab-sidebar/note-indicator-toolbar.js +73 -60
  330. package/src/components/collab-sidebar/note.js +64 -29
  331. package/src/components/collab-sidebar/style.scss +20 -0
  332. package/src/components/collaborators-overlay/use-block-highlighting.ts +0 -9
  333. package/src/components/collaborators-overlay/use-render-cursors.ts +0 -8
  334. package/src/components/collaborators-presence/avatar/component.tsx +0 -1
  335. package/src/components/collaborators-presence/avatar/test/index.tsx +8 -4
  336. package/src/components/document-bar/index.js +8 -3
  337. package/src/components/document-bar/style.scss +4 -2
  338. package/src/components/global-keyboard-shortcuts/index.js +2 -1
  339. package/src/components/local-autosave-monitor/index.js +23 -21
  340. package/src/components/more-menu/view-more-menu-group.js +1 -2
  341. package/src/components/page-attributes/parent.js +1 -0
  342. package/src/components/post-card-panel/index.js +1 -1
  343. package/src/components/post-publish-button/index.js +146 -192
  344. package/src/components/post-publish-button/test/index.js +149 -113
  345. package/src/components/post-revisions-preview/block-diff.js +63 -19
  346. package/src/components/post-revisions-preview/diff-markers.js +0 -1
  347. package/src/components/post-revisions-preview/preserve-client-ids.js +1 -1
  348. package/src/components/post-revisions-preview/test/block-diff.js +109 -6
  349. package/src/components/post-revisions-timeline/index.js +186 -0
  350. package/src/components/post-revisions-timeline/style.scss +43 -0
  351. package/src/components/post-saved-state/index.js +23 -26
  352. package/src/components/post-saved-state/test/index.js +18 -0
  353. package/src/components/post-taxonomies/flat-term-selector.js +4 -7
  354. package/src/components/post-text-editor/index.js +65 -0
  355. package/src/components/post-text-editor/test/utils.js +210 -0
  356. package/src/components/post-text-editor/utils.js +204 -0
  357. package/src/components/post-type-support-check/test/index.js +11 -0
  358. package/src/components/post-url/index.js +1 -1
  359. package/src/components/post-view-link/index.js +1 -1
  360. package/src/components/post-view-link/test/index.js +71 -0
  361. package/src/components/provider/index.js +6 -1
  362. package/src/components/provider/test/use-network-reconnect.js +137 -0
  363. package/src/components/provider/use-network-reconnect.js +44 -0
  364. package/src/components/resizable-editor/resize-handle.js +0 -1
  365. package/src/components/revision-diff-panel/index.js +8 -2
  366. package/src/components/revision-fields-diff/index.js +19 -3
  367. package/src/components/sidebar/dataform-post-summary.js +196 -25
  368. package/src/components/sidebar/index.js +4 -23
  369. package/src/components/sidebar/post-revision-summary.js +8 -15
  370. package/src/components/sidebar/post-summary.js +1 -1
  371. package/src/components/style-book/index.js +1 -1
  372. package/src/components/template-actions-panel/block-theme-content.js +10 -2
  373. package/src/components/template-actions-panel/index.js +0 -15
  374. package/src/components/upload-progress-snackbar/README.md +26 -0
  375. package/src/components/upload-progress-snackbar/index.js +216 -0
  376. package/src/components/upload-progress-snackbar/stories/index.story.tsx +85 -0
  377. package/src/components/upload-progress-snackbar/style.scss +30 -0
  378. package/src/components/upload-progress-snackbar/test/index.js +199 -0
  379. package/src/components/upload-progress-snackbar/tracker.js +105 -0
  380. package/src/dataviews/fields/revisions/index.tsx +28 -0
  381. package/src/dataviews/fields/revisions/revisions-view.tsx +59 -0
  382. package/src/dataviews/store/private-actions.ts +27 -6
  383. package/src/private-apis.js +2 -0
  384. package/src/store/private-selectors.js +11 -1
  385. package/src/store/selectors.js +1 -3
  386. package/src/store/test/private-selectors.js +69 -0
  387. package/src/style.scss +2 -1
  388. package/src/utils/media-upload/index.js +27 -0
  389. package/build/components/post-revisions-panel/index.cjs +0 -173
  390. package/build/components/post-revisions-panel/index.cjs.map +0 -7
  391. package/build/components/revision-author-panel/index.cjs.map +0 -7
  392. package/build/components/revision-created-panel/index.cjs +0 -47
  393. package/build/components/revision-created-panel/index.cjs.map +0 -7
  394. package/build-module/components/post-revisions-panel/index.mjs +0 -148
  395. package/build-module/components/post-revisions-panel/index.mjs.map +0 -7
  396. package/build-module/components/revision-author-panel/index.mjs +0 -28
  397. package/build-module/components/revision-author-panel/index.mjs.map +0 -7
  398. package/build-module/components/revision-created-panel/index.mjs +0 -26
  399. package/build-module/components/revision-created-panel/index.mjs.map +0 -7
  400. package/build-types/components/post-revisions-panel/index.d.ts +0 -2
  401. package/build-types/components/post-revisions-panel/index.d.ts.map +0 -1
  402. package/build-types/components/revision-author-panel/index.d.ts +0 -2
  403. package/build-types/components/revision-author-panel/index.d.ts.map +0 -1
  404. package/build-types/components/revision-created-panel/index.d.ts +0 -2
  405. package/build-types/components/revision-created-panel/index.d.ts.map +0 -1
  406. package/src/components/commands/index.native.js +0 -2
  407. package/src/components/deprecated.native.js +0 -47
  408. package/src/components/editor-help/add-blocks.native.js +0 -40
  409. package/src/components/editor-help/customize-blocks.native.js +0 -40
  410. package/src/components/editor-help/help-detail-navigation-screen.native.js +0 -67
  411. package/src/components/editor-help/help-get-support-button.native.js +0 -38
  412. package/src/components/editor-help/help-section-title.native.js +0 -29
  413. package/src/components/editor-help/help-topic-row.native.js +0 -33
  414. package/src/components/editor-help/icon-move-blocks.native.js +0 -10
  415. package/src/components/editor-help/images/add-dark.png +0 -0
  416. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  417. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  418. package/src/components/editor-help/images/add-light.png +0 -0
  419. package/src/components/editor-help/images/add-light@2x.png +0 -0
  420. package/src/components/editor-help/images/add-light@3x.png +0 -0
  421. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  422. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  423. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  424. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  425. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  426. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  427. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  428. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  429. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  430. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  431. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  432. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  433. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  434. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  435. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  436. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  437. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  438. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  439. package/src/components/editor-help/images/edit-media-light.png +0 -0
  440. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  441. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  442. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  443. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  444. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  445. package/src/components/editor-help/images/embed-media-light.png +0 -0
  446. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  447. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  448. package/src/components/editor-help/images/move-dark.png +0 -0
  449. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  450. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  451. package/src/components/editor-help/images/move-light.png +0 -0
  452. package/src/components/editor-help/images/move-light@2x.png +0 -0
  453. package/src/components/editor-help/images/move-light@3x.png +0 -0
  454. package/src/components/editor-help/images/options-dark.png +0 -0
  455. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  456. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  457. package/src/components/editor-help/images/options-light.png +0 -0
  458. package/src/components/editor-help/images/options-light@2x.png +0 -0
  459. package/src/components/editor-help/images/options-light@3x.png +0 -0
  460. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  461. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  462. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  463. package/src/components/editor-help/images/rich-text-light.png +0 -0
  464. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  465. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  466. package/src/components/editor-help/images/settings-dark.png +0 -0
  467. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  468. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  469. package/src/components/editor-help/images/settings-light.png +0 -0
  470. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  471. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  472. package/src/components/editor-help/index.native.js +0 -208
  473. package/src/components/editor-help/intro-to-blocks.native.js +0 -91
  474. package/src/components/editor-help/move-blocks.native.js +0 -55
  475. package/src/components/editor-help/remove-blocks.native.js +0 -35
  476. package/src/components/editor-help/style.android.scss +0 -6
  477. package/src/components/editor-help/style.ios.scss +0 -6
  478. package/src/components/editor-help/style.scss +0 -123
  479. package/src/components/editor-help/test/index.native.js +0 -81
  480. package/src/components/editor-help/view-sections.native.js +0 -79
  481. package/src/components/error-boundary/index.native.js +0 -192
  482. package/src/components/error-boundary/style.native.scss +0 -116
  483. package/src/components/index.native.js +0 -15
  484. package/src/components/offline-status/index.native.js +0 -99
  485. package/src/components/offline-status/style.native.scss +0 -28
  486. package/src/components/offline-status/test/index.native.js +0 -108
  487. package/src/components/post-revisions-panel/index.js +0 -161
  488. package/src/components/post-revisions-panel/style.scss +0 -16
  489. package/src/components/post-title/index.native.js +0 -282
  490. package/src/components/post-title/style.native.scss +0 -13
  491. package/src/components/post-title/test/__snapshots__/index.native.js.snap +0 -25
  492. package/src/components/post-title/test/index.native.js +0 -78
  493. package/src/components/provider/index.native.js +0 -497
  494. package/src/components/provider/use-block-editor-settings.native.js +0 -48
  495. package/src/components/revision-author-panel/index.js +0 -36
  496. package/src/components/revision-created-panel/index.js +0 -36
  497. package/src/components/template-part-menu-items/index.native.js +0 -3
  498. package/src/hooks/index.native.js +0 -0
  499. package/src/index.native.js +0 -16
  500. package/src/private-apis.native.js +0 -33
  501. package/src/store/actions.native.js +0 -27
  502. package/src/store/reducer.native.js +0 -94
  503. package/src/store/selectors.native.js +0 -57
  504. package/src/store/test/actions.native.js +0 -16
  505. package/src/store/test/reducer.native.js +0 -36
  506. package/src/store/test/selectors.native.js +0 -28
  507. package/src/utils/index.native.js +0 -6
  508. package/src/utils/media-sideload/index.native.js +0 -1
  509. package/src/utils/media-upload/index.native.js +0 -1
@@ -7,7 +7,6 @@ import userEvent from '@testing-library/user-event';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- // eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
11
10
  import { Tooltip } from '@wordpress/ui';
12
11
 
13
12
  /**
@@ -16,13 +15,18 @@ import { Tooltip } from '@wordpress/ui';
16
15
  import Avatar from '..';
17
16
 
18
17
  /**
19
- * Wraps the avatar in a `Tooltip.Provider` with `delay={ 0 }` so hover-based
20
- * tooltip-presence assertions don't have to wait for the real-world delay.
18
+ * Wraps the avatar in a `Tooltip.Provider` with `delay={ 0 }` and
19
+ * `closeDelay={ 0 }` so hover-based tooltip-presence assertions don't have to
20
+ * wait for the real-world open/close delay.
21
21
  *
22
22
  * @param ui The avatar element (or anything else) to render.
23
23
  */
24
24
  function renderAvatar( ui: React.ReactElement ): ReturnType< typeof render > {
25
- return render( <Tooltip.Provider delay={ 0 }>{ ui }</Tooltip.Provider> );
25
+ return render(
26
+ <Tooltip.Provider delay={ 0 } closeDelay={ 0 }>
27
+ { ui }
28
+ </Tooltip.Provider>
29
+ );
26
30
  }
27
31
 
28
32
  /**
@@ -141,6 +141,8 @@ export default function DocumentBar( props ) {
141
141
  const { open: openCommandCenter } = useDispatch( commandsStore );
142
142
  const isReducedMotion = useReducedMotion();
143
143
 
144
+ const hasShortcut = ! window.__experimentalAdminBarInEditor;
145
+
144
146
  const isTemplate = TEMPLATE_POST_TYPES.includes( postType );
145
147
  const hasBackButton =
146
148
  !! onNavigateToPreviousEntityRecord || !! unlockedPatternInfo;
@@ -175,6 +177,7 @@ export default function DocumentBar( props ) {
175
177
  <div
176
178
  className={ clsx( 'editor-document-bar', {
177
179
  'has-back-button': hasBackButton,
180
+ 'has-shortcut': hasShortcut,
178
181
  } ) }
179
182
  >
180
183
  <AnimatePresence>
@@ -267,9 +270,11 @@ export default function DocumentBar( props ) {
267
270
  ) }
268
271
  </WCText>
269
272
  </motion.div>
270
- <span className="editor-document-bar__shortcut">
271
- { displayShortcut.primary( 'k' ) }
272
- </span>
273
+ { hasShortcut && (
274
+ <span className="editor-document-bar__shortcut">
275
+ { displayShortcut.primary( 'k' ) }
276
+ </span>
277
+ ) }
273
278
  </Button>
274
279
  ) }
275
280
  </div>
@@ -55,8 +55,10 @@
55
55
  max-width: 70%;
56
56
 
57
57
  // Offset the layout based on the width of the ⌘K label. This ensures the title is centrally aligned.
58
- @include break-medium() {
59
- padding-left: $grid-unit-30;
58
+ .editor-document-bar.has-shortcut & {
59
+ @include break-medium() {
60
+ padding-left: $grid-unit-30;
61
+ }
60
62
  }
61
63
 
62
64
  h1 {
@@ -41,6 +41,7 @@ export default function EditorKeyboardShortcuts() {
41
41
  isPostSavingLocked,
42
42
  isListViewOpened,
43
43
  getEditorMode,
44
+ isSavingNonPostEntityChanges,
44
45
  } = useSelect( editorStore );
45
46
 
46
47
  useShortcut(
@@ -75,7 +76,7 @@ export default function EditorKeyboardShortcuts() {
75
76
  /**
76
77
  * Do not save the post if post saving is locked.
77
78
  */
78
- if ( isPostSavingLocked() ) {
79
+ if ( isPostSavingLocked() || isSavingNonPostEntityChanges() ) {
79
80
  return;
80
81
  }
81
82
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { useCallback, useEffect, useRef } from '@wordpress/element';
5
5
  import { ifCondition, usePrevious } from '@wordpress/compose';
6
- import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import { parse } from '@wordpress/blocks';
9
9
  import { store as noticesStore } from '@wordpress/notices';
@@ -53,19 +53,14 @@ const hasSessionStorageSupport = () => {
53
53
  * restore a local autosave, if one exists.
54
54
  */
55
55
  function useAutosaveNotice() {
56
- const { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(
56
+ const registry = useRegistry();
57
+ const { postId, isEditedPostNew } = useSelect(
57
58
  ( select ) => ( {
58
59
  postId: select( editorStore ).getCurrentPostId(),
59
60
  isEditedPostNew: select( editorStore ).isEditedPostNew(),
60
- hasRemoteAutosave:
61
- !! select( editorStore ).getEditorSettings().autosave,
62
61
  } ),
63
62
  []
64
63
  );
65
- const { getEditedPostAttribute } = useSelect( editorStore );
66
-
67
- const { createWarningNotice, removeNotice } = useDispatch( noticesStore );
68
- const { editPost, resetEditorBlocks } = useDispatch( editorStore );
69
64
 
70
65
  useEffect( () => {
71
66
  let localAutosave = localAutosaveGet( postId, isEditedPostNew );
@@ -83,24 +78,31 @@ function useAutosaveNotice() {
83
78
  const { post_title: title, content, excerpt } = localAutosave;
84
79
  const edits = { title, content, excerpt };
85
80
 
86
- {
87
- // Only display a notice if there is a difference between what has been
88
- // saved and that which is stored in sessionStorage.
89
- const hasDifference = Object.keys( edits ).some( ( key ) => {
90
- return edits[ key ] !== getEditedPostAttribute( key );
91
- } );
92
-
93
- if ( ! hasDifference ) {
94
- // If there is no difference, it can be safely ejected from storage.
95
- localAutosaveClear( postId, isEditedPostNew );
96
- return;
97
- }
81
+ const { getEditedPostAttribute, getEditorSettings } =
82
+ registry.select( editorStore );
83
+
84
+ // Only display a notice if there is a difference between what has been
85
+ // saved and that which is stored in sessionStorage.
86
+ const hasDifference = Object.keys( edits ).some( ( key ) => {
87
+ return edits[ key ] !== getEditedPostAttribute( key );
88
+ } );
89
+
90
+ if ( ! hasDifference ) {
91
+ // If there is no difference, it can be safely ejected from storage.
92
+ localAutosaveClear( postId, isEditedPostNew );
93
+ return;
98
94
  }
99
95
 
96
+ const hasRemoteAutosave = !! getEditorSettings().autosave;
100
97
  if ( hasRemoteAutosave ) {
101
98
  return;
102
99
  }
103
100
 
101
+ const { createWarningNotice, removeNotice } =
102
+ registry.dispatch( noticesStore );
103
+ const { editPost, resetEditorBlocks } =
104
+ registry.dispatch( editorStore );
105
+
104
106
  const id = 'wpEditorAutosaveRestore';
105
107
 
106
108
  createWarningNotice(
@@ -125,7 +127,7 @@ function useAutosaveNotice() {
125
127
  ],
126
128
  }
127
129
  );
128
- }, [ isEditedPostNew, postId ] );
130
+ }, [ registry, postId, isEditedPostNew ] );
129
131
  }
130
132
 
131
133
  /**
@@ -2,10 +2,9 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createSlotFill } from '@wordpress/components';
5
- import { Platform } from '@wordpress/element';
6
5
 
7
6
  const { Fill: ViewMoreMenuGroup, Slot } = createSlotFill(
8
- Platform.OS === 'web' ? Symbol( 'ViewMoreMenuGroup' ) : 'ViewMoreMenuGroup'
7
+ Symbol( 'ViewMoreMenuGroup' )
9
8
  );
10
9
 
11
10
  ViewMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
@@ -95,6 +95,7 @@ export function PageAttributesParent() {
95
95
  if ( !! fieldValue ) {
96
96
  query.search = fieldValue;
97
97
  query.orderby = 'relevance';
98
+ query.search_columns = [ 'post_title' ];
98
99
  }
99
100
 
100
101
  const parentPost = pageId
@@ -168,7 +168,7 @@ export default function PostCardPanel( {
168
168
  { sprintf(
169
169
  // translators: %s: Name of the plural post type e.g: "Posts".
170
170
  __( 'Changes will be applied to all selected %s.' ),
171
- labels?.name.toLowerCase()
171
+ labels?.name?.toLowerCase()
172
172
  ) }
173
173
  </WCText>
174
174
  ) }
@@ -2,9 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Button } from '@wordpress/components';
5
- import { Component } from '@wordpress/element';
6
- import { withSelect, withDispatch } from '@wordpress/data';
7
- import { compose } from '@wordpress/compose';
5
+ import { useDispatch, useSelect } from '@wordpress/data';
8
6
 
9
7
  /**
10
8
  * Internal dependencies
@@ -14,220 +12,176 @@ import { store as editorStore } from '../../store';
14
12
 
15
13
  const noop = () => {};
16
14
 
17
- export class PostPublishButton extends Component {
18
- constructor( props ) {
19
- super( props );
15
+ export function PostPublishButton( {
16
+ forceIsDirty,
17
+ isOpen,
18
+ isToggle,
19
+ onSubmit = noop,
20
+ onToggle,
21
+ setEntitiesSavedStatesCallback,
22
+ } ) {
23
+ const {
24
+ hasPublishAction,
25
+ isBeingScheduled,
26
+ isPostSavingLocked,
27
+ isPublishable,
28
+ isPublished,
29
+ isSaveable,
30
+ isSaving,
31
+ isAutoSaving,
32
+ visibility,
33
+ hasNonPostEntityChanges,
34
+ isSavingNonPostEntityChanges,
35
+ postStatus,
36
+ postStatusHasChanged,
37
+ postType,
38
+ postId,
39
+ } = useSelect( ( select ) => {
40
+ const store = select( editorStore );
41
+ return {
42
+ isSaving: store.isSavingPost(),
43
+ isAutoSaving: store.isAutosavingPost(),
44
+ isBeingScheduled: store.isEditedPostBeingScheduled(),
45
+ visibility: store.getEditedPostVisibility(),
46
+ isSaveable: store.isEditedPostSaveable(),
47
+ isPostSavingLocked: store.isPostSavingLocked(),
48
+ isPublishable: store.isEditedPostPublishable(),
49
+ isPublished: store.isCurrentPostPublished(),
50
+ hasPublishAction:
51
+ !! store.getCurrentPost()?._links?.[ 'wp:action-publish' ],
52
+ postType: store.getCurrentPostType(),
53
+ postId: store.getCurrentPostId(),
54
+ postStatus: store.getEditedPostAttribute( 'status' ),
55
+ postStatusHasChanged: store.getPostEdits()?.status,
56
+ hasNonPostEntityChanges: store.hasNonPostEntityChanges(),
57
+ isSavingNonPostEntityChanges: store.isSavingNonPostEntityChanges(),
58
+ };
59
+ }, [] );
20
60
 
21
- this.createOnClick = this.createOnClick.bind( this );
22
- this.closeEntitiesSavedStates =
23
- this.closeEntitiesSavedStates.bind( this );
61
+ const { editPost, savePost } = useDispatch( editorStore );
24
62
 
25
- this.state = {
26
- entitiesSavedStatesCallback: false,
27
- };
28
- }
63
+ const savePostStatus = ( status ) => {
64
+ editPost( { status }, { undoIgnore: true } );
65
+ savePost();
66
+ };
29
67
 
30
- createOnClick( callback ) {
31
- return ( ...args ) => {
32
- const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
33
- this.props;
68
+ const createOnClick =
69
+ ( callback ) =>
70
+ ( ...args ) => {
34
71
  // If a post with non-post entities is published, but the user
35
72
  // elects to not save changes to the non-post entities, those
36
73
  // entities will still be dirty when the Publish button is clicked.
37
74
  // We also need to check that the `setEntitiesSavedStatesCallback`
38
75
  // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
39
76
  if ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {
40
- // The modal for multiple entity saving will open,
41
- // hold the callback for saving/publishing the post
42
- // so that we can call it if the post entity is checked.
43
- this.setState( {
44
- entitiesSavedStatesCallback: () => callback( ...args ),
45
- } );
77
+ // The modal for multiple entity saving will open. If the post
78
+ // entity is checked when it closes, run the held callback.
79
+ const onClose = ( savedEntities ) => {
80
+ if (
81
+ savedEntities &&
82
+ savedEntities.some(
83
+ ( elt ) =>
84
+ elt.kind === 'postType' &&
85
+ elt.name === postType &&
86
+ elt.key === postId
87
+ )
88
+ ) {
89
+ callback( ...args );
90
+ }
91
+ };
46
92
 
47
93
  // Open the save panel by setting its callback.
48
94
  // To set a function on the useState hook, we must set it
49
95
  // with another function (() => myFunction). Passing the
50
96
  // function on its own will cause an error when called.
51
- setEntitiesSavedStatesCallback(
52
- () => this.closeEntitiesSavedStates
53
- );
97
+ setEntitiesSavedStatesCallback( () => onClose );
54
98
  return noop;
55
99
  }
56
100
 
57
101
  return callback( ...args );
58
102
  };
59
- }
60
103
 
61
- closeEntitiesSavedStates( savedEntities ) {
62
- const { postType, postId } = this.props;
63
- const { entitiesSavedStatesCallback } = this.state;
64
- this.setState( { entitiesSavedStatesCallback: false }, () => {
65
- if (
66
- savedEntities &&
67
- savedEntities.some(
68
- ( elt ) =>
69
- elt.kind === 'postType' &&
70
- elt.name === postType &&
71
- elt.key === postId
72
- )
73
- ) {
74
- // The post entity was checked, call the held callback from `createOnClick`.
75
- entitiesSavedStatesCallback();
76
- }
77
- } );
104
+ const isButtonDisabled =
105
+ isPostSavingLocked ||
106
+ // Disable while a non-post entity (e.g. a newly created term) is mid-save.
107
+ isSavingNonPostEntityChanges ||
108
+ ( ( isSaving ||
109
+ ! isSaveable ||
110
+ ( ! isPublishable && ! forceIsDirty ) ) &&
111
+ ! hasNonPostEntityChanges );
112
+
113
+ const isToggleDisabled =
114
+ isPostSavingLocked ||
115
+ isSavingNonPostEntityChanges ||
116
+ ( ( isPublished ||
117
+ isSaving ||
118
+ ! isSaveable ||
119
+ ( ! isPublishable && ! forceIsDirty ) ) &&
120
+ ! hasNonPostEntityChanges );
121
+
122
+ // If the new status has not changed explicitly, we derive it from
123
+ // other factors, like having a publish action, etc.. We need to preserve
124
+ // this because it affects when to show the pre and post publish panels.
125
+ // If it has changed though explicitly, we need to respect that.
126
+ let publishStatus = 'publish';
127
+ if ( postStatusHasChanged ) {
128
+ publishStatus = postStatus;
129
+ } else if ( ! hasPublishAction ) {
130
+ publishStatus = 'pending';
131
+ } else if ( visibility === 'private' ) {
132
+ publishStatus = 'private';
133
+ } else if ( isBeingScheduled ) {
134
+ publishStatus = 'future';
78
135
  }
79
136
 
80
- render() {
81
- const {
82
- forceIsDirty,
83
- hasPublishAction,
84
- isBeingScheduled,
85
- isOpen,
86
- isPostSavingLocked,
87
- isPublishable,
88
- isPublished,
89
- isSaveable,
90
- isSaving,
91
- isAutoSaving,
92
- isToggle,
93
- savePostStatus,
94
- onSubmit = noop,
95
- onToggle,
96
- visibility,
97
- hasNonPostEntityChanges,
98
- isSavingNonPostEntityChanges,
99
- postStatus,
100
- postStatusHasChanged,
101
- } = this.props;
102
-
103
- const isButtonDisabled =
104
- isPostSavingLocked ||
105
- ( ( isSaving ||
106
- ! isSaveable ||
107
- ( ! isPublishable && ! forceIsDirty ) ) &&
108
- ( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges ) );
109
-
110
- const isToggleDisabled =
111
- isPostSavingLocked ||
112
- ( ( isPublished ||
113
- isSaving ||
114
- ! isSaveable ||
115
- ( ! isPublishable && ! forceIsDirty ) ) &&
116
- ( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges ) );
117
-
118
- // If the new status has not changed explicitly, we derive it from
119
- // other factors, like having a publish action, etc.. We need to preserve
120
- // this because it affects when to show the pre and post publish panels.
121
- // If it has changed though explicitly, we need to respect that.
122
- let publishStatus = 'publish';
123
- if ( postStatusHasChanged ) {
124
- publishStatus = postStatus;
125
- } else if ( ! hasPublishAction ) {
126
- publishStatus = 'pending';
127
- } else if ( visibility === 'private' ) {
128
- publishStatus = 'private';
129
- } else if ( isBeingScheduled ) {
130
- publishStatus = 'future';
137
+ const onClickButton = () => {
138
+ if ( isButtonDisabled ) {
139
+ return;
131
140
  }
132
-
133
- const onClickButton = () => {
134
- if ( isButtonDisabled ) {
135
- return;
136
- }
137
- onSubmit();
138
- savePostStatus( publishStatus );
139
- };
140
-
141
- // Callback to open the publish panel.
142
- const onClickToggle = () => {
143
- if ( isToggleDisabled ) {
144
- return;
145
- }
146
- onToggle();
147
- };
148
-
149
- const buttonProps = {
150
- 'aria-disabled': isButtonDisabled,
151
- className: 'editor-post-publish-button',
152
- isBusy: ! isAutoSaving && isSaving,
153
- variant: 'primary',
154
- onClick: this.createOnClick( onClickButton ),
155
- 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined,
156
- };
157
-
158
- const toggleProps = {
159
- 'aria-disabled': isToggleDisabled,
160
- 'aria-expanded': isOpen,
161
- className: 'editor-post-publish-panel__toggle',
162
- isBusy: isSaving && isPublished,
163
- variant: 'primary',
164
- size: 'compact',
165
- onClick: this.createOnClick( onClickToggle ),
166
- 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined,
167
- };
168
- const componentProps = isToggle ? toggleProps : buttonProps;
169
- return (
170
- <>
171
- <Button
172
- { ...componentProps }
173
- className={ `${ componentProps.className } editor-post-publish-button__button` }
174
- size="compact"
175
- >
176
- <PublishButtonLabel />
177
- </Button>
178
- </>
179
- );
180
- }
141
+ onSubmit();
142
+ savePostStatus( publishStatus );
143
+ };
144
+
145
+ // Callback to open the publish panel.
146
+ const onClickToggle = () => {
147
+ if ( isToggleDisabled ) {
148
+ return;
149
+ }
150
+ onToggle();
151
+ };
152
+
153
+ const buttonProps = {
154
+ 'aria-disabled': isButtonDisabled,
155
+ className: 'editor-post-publish-button',
156
+ isBusy: ! isAutoSaving && isSaving,
157
+ variant: 'primary',
158
+ onClick: createOnClick( onClickButton ),
159
+ 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined,
160
+ };
161
+
162
+ const toggleProps = {
163
+ 'aria-disabled': isToggleDisabled,
164
+ 'aria-expanded': isOpen,
165
+ className: 'editor-post-publish-panel__toggle',
166
+ isBusy: isSaving && isPublished,
167
+ variant: 'primary',
168
+ size: 'compact',
169
+ onClick: createOnClick( onClickToggle ),
170
+ 'aria-haspopup': hasNonPostEntityChanges ? 'dialog' : undefined,
171
+ };
172
+ const componentProps = isToggle ? toggleProps : buttonProps;
173
+ return (
174
+ <Button
175
+ { ...componentProps }
176
+ className={ `${ componentProps.className } editor-post-publish-button__button` }
177
+ size="compact"
178
+ >
179
+ <PublishButtonLabel />
180
+ </Button>
181
+ );
181
182
  }
182
183
 
183
184
  /**
184
185
  * Renders the publish button.
185
186
  */
186
- export default compose( [
187
- withSelect( ( select ) => {
188
- const {
189
- isSavingPost,
190
- isAutosavingPost,
191
- isEditedPostBeingScheduled,
192
- getEditedPostVisibility,
193
- isCurrentPostPublished,
194
- isEditedPostSaveable,
195
- isEditedPostPublishable,
196
- isPostSavingLocked,
197
- getCurrentPost,
198
- getCurrentPostType,
199
- getCurrentPostId,
200
- hasNonPostEntityChanges,
201
- isSavingNonPostEntityChanges,
202
- getEditedPostAttribute,
203
- getPostEdits,
204
- } = select( editorStore );
205
- return {
206
- isSaving: isSavingPost(),
207
- isAutoSaving: isAutosavingPost(),
208
- isBeingScheduled: isEditedPostBeingScheduled(),
209
- visibility: getEditedPostVisibility(),
210
- isSaveable: isEditedPostSaveable(),
211
- isPostSavingLocked: isPostSavingLocked(),
212
- isPublishable: isEditedPostPublishable(),
213
- isPublished: isCurrentPostPublished(),
214
- hasPublishAction:
215
- getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
216
- postType: getCurrentPostType(),
217
- postId: getCurrentPostId(),
218
- postStatus: getEditedPostAttribute( 'status' ),
219
- postStatusHasChanged: getPostEdits()?.status,
220
- hasNonPostEntityChanges: hasNonPostEntityChanges(),
221
- isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
222
- };
223
- } ),
224
- withDispatch( ( dispatch ) => {
225
- const { editPost, savePost } = dispatch( editorStore );
226
- return {
227
- savePostStatus: ( status ) => {
228
- editPost( { status }, { undoIgnore: true } );
229
- savePost();
230
- },
231
- };
232
- } ),
233
- ] )( PostPublishButton );
187
+ export default PostPublishButton;