@wordpress/editor 14.40.2-next.v.202602241322.0 → 14.40.2

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 (464) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/collab-sidebar/index.cjs +7 -4
  3. package/build/components/collab-sidebar/index.cjs.map +2 -2
  4. package/build/components/collab-sidebar/utils.cjs +13 -15
  5. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  6. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs +141 -0
  7. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +7 -0
  8. package/build/components/collaborators-overlay/collaborator-styles.cjs +38 -2
  9. package/build/components/collaborators-overlay/collaborator-styles.cjs.map +2 -2
  10. package/build/components/collaborators-overlay/compute-selection.cjs +185 -0
  11. package/build/components/collaborators-overlay/compute-selection.cjs.map +7 -0
  12. package/build/components/collaborators-overlay/cursor-dom-utils.cjs +243 -0
  13. package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +7 -0
  14. package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
  15. package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
  16. package/build/components/collaborators-overlay/index.cjs +7 -2
  17. package/build/components/collaborators-overlay/index.cjs.map +2 -2
  18. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +148 -0
  19. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +7 -0
  20. package/build/components/collaborators-overlay/overlay.cjs +146 -236
  21. package/build/components/collaborators-overlay/overlay.cjs.map +3 -3
  22. package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
  23. package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
  24. package/build/components/collaborators-overlay/use-block-highlighting.cjs +91 -42
  25. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
  26. package/build/components/collaborators-overlay/use-debounced-recompute.cjs +49 -0
  27. package/build/components/collaborators-overlay/use-debounced-recompute.cjs.map +7 -0
  28. package/build/components/collaborators-overlay/use-render-cursors.cjs +82 -172
  29. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
  30. package/build/components/collaborators-presence/avatar/component.cjs +121 -0
  31. package/build/components/collaborators-presence/avatar/component.cjs.map +7 -0
  32. package/build/components/collaborators-presence/avatar/index.cjs +37 -0
  33. package/build/components/collaborators-presence/avatar/index.cjs.map +7 -0
  34. package/build/components/collaborators-presence/avatar/types.cjs +19 -0
  35. package/build/components/collaborators-presence/avatar/types.cjs.map +7 -0
  36. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs +44 -0
  37. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +7 -0
  38. package/build/components/collaborators-presence/avatar-group/component.cjs +78 -0
  39. package/build/components/collaborators-presence/avatar-group/component.cjs.map +7 -0
  40. package/build/components/collaborators-presence/avatar-group/index.cjs +37 -0
  41. package/build/components/collaborators-presence/avatar-group/index.cjs.map +7 -0
  42. package/build/components/collaborators-presence/avatar-group/types.cjs +19 -0
  43. package/build/components/collaborators-presence/avatar-group/types.cjs.map +7 -0
  44. package/build/components/collaborators-presence/index.cjs +66 -19
  45. package/build/components/collaborators-presence/index.cjs.map +3 -3
  46. package/build/components/collaborators-presence/list.cjs +60 -38
  47. package/build/components/collaborators-presence/list.cjs.map +3 -3
  48. package/build/components/collaborators-presence/use-collaborator-notifications.cjs +149 -0
  49. package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +7 -0
  50. package/build/components/editor-interface/index.cjs +11 -6
  51. package/build/components/editor-interface/index.cjs.map +2 -2
  52. package/build/components/inserter-sidebar/index.cjs +2 -1
  53. package/build/components/inserter-sidebar/index.cjs.map +2 -2
  54. package/build/components/post-last-revision/index.cjs +27 -6
  55. package/build/components/post-last-revision/index.cjs.map +2 -2
  56. package/build/components/post-locked-modal/index.cjs +49 -17
  57. package/build/components/post-locked-modal/index.cjs.map +3 -3
  58. package/build/components/post-revisions-preview/block-diff.cjs +130 -34
  59. package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
  60. package/build/components/post-revisions-preview/diff-markers.cjs +6 -5
  61. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  62. package/build/components/post-revisions-preview/revisions-canvas.cjs +16 -60
  63. package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
  64. package/build/components/post-revisions-preview/revisions-header.cjs +33 -26
  65. package/build/components/post-revisions-preview/revisions-header.cjs.map +3 -3
  66. package/build/components/post-revisions-preview/revisions-slider.cjs +104 -39
  67. package/build/components/post-revisions-preview/revisions-slider.cjs.map +3 -3
  68. package/build/components/preferences-modal/index.cjs +36 -4
  69. package/build/components/preferences-modal/index.cjs.map +2 -2
  70. package/build/components/provider/disable-non-page-content-blocks.cjs +31 -28
  71. package/build/components/provider/disable-non-page-content-blocks.cjs.map +3 -3
  72. package/build/components/provider/index.cjs +17 -5
  73. package/build/components/provider/index.cjs.map +2 -2
  74. package/build/components/provider/use-block-editor-settings.cjs +20 -4
  75. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  76. package/build/components/provider/{use-post-content-blocks.cjs → use-post-content-block-types.cjs} +8 -19
  77. package/build/components/provider/use-post-content-block-types.cjs.map +7 -0
  78. package/build/components/provider/use-revision-blocks.cjs +106 -0
  79. package/build/components/provider/use-revision-blocks.cjs.map +7 -0
  80. package/build/components/revision-block-diff/index.cjs +61 -0
  81. package/build/components/revision-block-diff/index.cjs.map +7 -0
  82. package/build/components/revision-diff-panel/index.cjs +68 -0
  83. package/build/components/revision-diff-panel/index.cjs.map +7 -0
  84. package/build/components/revision-fields-diff/index.cjs +96 -0
  85. package/build/components/revision-fields-diff/index.cjs.map +7 -0
  86. package/build/components/sidebar/header.cjs +1 -1
  87. package/build/components/sidebar/header.cjs.map +2 -2
  88. package/build/components/sidebar/index.cjs +7 -1
  89. package/build/components/sidebar/index.cjs.map +3 -3
  90. package/build/components/style-book/index.cjs +4 -3
  91. package/build/components/style-book/index.cjs.map +2 -2
  92. package/build/components/sync-connection-error-modal/index.cjs +187 -0
  93. package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
  94. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +84 -0
  95. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
  96. package/build/components/template-content-panel/index.cjs +35 -31
  97. package/build/components/template-content-panel/index.cjs.map +3 -3
  98. package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
  99. package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
  100. package/build/components/visual-editor/index.cjs +6 -15
  101. package/build/components/visual-editor/index.cjs.map +2 -2
  102. package/build/store/private-actions.cjs +46 -2
  103. package/build/store/private-actions.cjs.map +2 -2
  104. package/build/store/private-selectors.cjs +156 -21
  105. package/build/store/private-selectors.cjs.map +2 -2
  106. package/build/store/reducer.cjs +27 -0
  107. package/build/store/reducer.cjs.map +2 -2
  108. package/build/store/selectors.cjs +0 -14
  109. package/build/store/selectors.cjs.map +2 -2
  110. package/build/utils/media-finalize/index.cjs +43 -0
  111. package/build/utils/media-finalize/index.cjs.map +7 -0
  112. package/build/utils/media-upload/on-success.cjs +46 -0
  113. package/build/utils/media-upload/on-success.cjs.map +7 -0
  114. package/build/utils/sync-error-messages.cjs +32 -15
  115. package/build/utils/sync-error-messages.cjs.map +3 -3
  116. package/build-module/components/collab-sidebar/index.mjs +7 -4
  117. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  118. package/build-module/components/collab-sidebar/utils.mjs +13 -15
  119. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  120. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +128 -0
  121. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +7 -0
  122. package/build-module/components/collaborators-overlay/collaborator-styles.mjs +25 -1
  123. package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +2 -2
  124. package/build-module/components/collaborators-overlay/compute-selection.mjs +166 -0
  125. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +7 -0
  126. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +213 -0
  127. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +7 -0
  128. package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
  129. package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
  130. package/build-module/components/collaborators-overlay/index.mjs +7 -2
  131. package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
  132. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +130 -0
  133. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +7 -0
  134. package/build-module/components/collaborators-overlay/overlay.mjs +137 -237
  135. package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
  136. package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
  137. package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
  138. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +93 -45
  139. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
  140. package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs +24 -0
  141. package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs.map +7 -0
  142. package/build-module/components/collaborators-overlay/use-render-cursors.mjs +83 -176
  143. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  144. package/build-module/components/collaborators-presence/avatar/component.mjs +90 -0
  145. package/build-module/components/collaborators-presence/avatar/component.mjs.map +7 -0
  146. package/build-module/components/collaborators-presence/avatar/index.mjs +6 -0
  147. package/build-module/components/collaborators-presence/avatar/index.mjs.map +7 -0
  148. package/build-module/components/collaborators-presence/avatar/types.mjs +1 -0
  149. package/build-module/components/collaborators-presence/avatar/types.mjs.map +7 -0
  150. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs +19 -0
  151. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +7 -0
  152. package/build-module/components/collaborators-presence/avatar-group/component.mjs +47 -0
  153. package/build-module/components/collaborators-presence/avatar-group/component.mjs.map +7 -0
  154. package/build-module/components/collaborators-presence/avatar-group/index.mjs +6 -0
  155. package/build-module/components/collaborators-presence/avatar-group/index.mjs.map +7 -0
  156. package/build-module/components/collaborators-presence/avatar-group/types.mjs +1 -0
  157. package/build-module/components/collaborators-presence/avatar-group/types.mjs.map +7 -0
  158. package/build-module/components/collaborators-presence/index.mjs +57 -23
  159. package/build-module/components/collaborators-presence/index.mjs.map +2 -2
  160. package/build-module/components/collaborators-presence/list.mjs +52 -44
  161. package/build-module/components/collaborators-presence/list.mjs.map +2 -2
  162. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +126 -0
  163. package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +7 -0
  164. package/build-module/components/editor-interface/index.mjs +12 -7
  165. package/build-module/components/editor-interface/index.mjs.map +2 -2
  166. package/build-module/components/inserter-sidebar/index.mjs +2 -1
  167. package/build-module/components/inserter-sidebar/index.mjs.map +2 -2
  168. package/build-module/components/post-last-revision/index.mjs +27 -6
  169. package/build-module/components/post-last-revision/index.mjs.map +2 -2
  170. package/build-module/components/post-locked-modal/index.mjs +49 -17
  171. package/build-module/components/post-locked-modal/index.mjs.map +2 -2
  172. package/build-module/components/post-revisions-preview/block-diff.mjs +130 -34
  173. package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
  174. package/build-module/components/post-revisions-preview/diff-markers.mjs +6 -5
  175. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  176. package/build-module/components/post-revisions-preview/revisions-canvas.mjs +18 -65
  177. package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
  178. package/build-module/components/post-revisions-preview/revisions-header.mjs +36 -33
  179. package/build-module/components/post-revisions-preview/revisions-header.mjs.map +2 -2
  180. package/build-module/components/post-revisions-preview/revisions-slider.mjs +112 -42
  181. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  182. package/build-module/components/preferences-modal/index.mjs +36 -4
  183. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  184. package/build-module/components/provider/disable-non-page-content-blocks.mjs +31 -28
  185. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
  186. package/build-module/components/provider/index.mjs +17 -5
  187. package/build-module/components/provider/index.mjs.map +2 -2
  188. package/build-module/components/provider/use-block-editor-settings.mjs +20 -4
  189. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  190. package/build-module/components/provider/use-post-content-block-types.mjs +23 -0
  191. package/build-module/components/provider/use-post-content-block-types.mjs.map +7 -0
  192. package/build-module/components/provider/use-revision-blocks.mjs +81 -0
  193. package/build-module/components/provider/use-revision-blocks.mjs.map +7 -0
  194. package/build-module/components/revision-block-diff/index.mjs +30 -0
  195. package/build-module/components/revision-block-diff/index.mjs.map +7 -0
  196. package/build-module/components/revision-diff-panel/index.mjs +37 -0
  197. package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
  198. package/build-module/components/revision-fields-diff/index.mjs +65 -0
  199. package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
  200. package/build-module/components/sidebar/header.mjs +1 -1
  201. package/build-module/components/sidebar/header.mjs.map +2 -2
  202. package/build-module/components/sidebar/index.mjs +7 -1
  203. package/build-module/components/sidebar/index.mjs.map +2 -2
  204. package/build-module/components/style-book/index.mjs +4 -3
  205. package/build-module/components/style-book/index.mjs.map +2 -2
  206. package/build-module/components/sync-connection-error-modal/index.mjs +170 -0
  207. package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
  208. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +59 -0
  209. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
  210. package/build-module/components/template-content-panel/index.mjs +25 -31
  211. package/build-module/components/template-content-panel/index.mjs.map +2 -2
  212. package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
  213. package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
  214. package/build-module/components/visual-editor/index.mjs +6 -15
  215. package/build-module/components/visual-editor/index.mjs.map +2 -2
  216. package/build-module/store/private-actions.mjs +44 -2
  217. package/build-module/store/private-actions.mjs.map +2 -2
  218. package/build-module/store/private-selectors.mjs +155 -21
  219. package/build-module/store/private-selectors.mjs.map +2 -2
  220. package/build-module/store/reducer.mjs +25 -0
  221. package/build-module/store/reducer.mjs.map +2 -2
  222. package/build-module/store/selectors.mjs +0 -13
  223. package/build-module/store/selectors.mjs.map +2 -2
  224. package/build-module/utils/media-finalize/index.mjs +12 -0
  225. package/build-module/utils/media-finalize/index.mjs.map +7 -0
  226. package/build-module/utils/media-upload/on-success.mjs +25 -0
  227. package/build-module/utils/media-upload/on-success.mjs.map +7 -0
  228. package/build-module/utils/sync-error-messages.mjs +27 -15
  229. package/build-module/utils/sync-error-messages.mjs.map +3 -3
  230. package/build-style/style-rtl.css +388 -132
  231. package/build-style/style.css +388 -132
  232. package/build-types/components/autocompleters/link.d.ts +8 -0
  233. package/build-types/components/autocompleters/link.d.ts.map +1 -0
  234. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
  235. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
  236. package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
  237. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
  238. package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
  239. package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
  240. package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
  241. package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
  242. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  243. package/build-types/components/collab-sidebar/note-byline.d.ts +10 -0
  244. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
  245. package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
  246. package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
  247. package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
  248. package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
  249. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
  250. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
  251. package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
  252. package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
  253. package/build-types/components/collab-sidebar/note.d.ts +9 -0
  254. package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
  255. package/build-types/components/collab-sidebar/notes.d.ts +7 -0
  256. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
  257. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  258. package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +11 -0
  259. package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts.map +1 -0
  260. package/build-types/components/collaborators-overlay/collaborator-styles.d.ts +17 -2
  261. package/build-types/components/collaborators-overlay/collaborator-styles.d.ts.map +1 -1
  262. package/build-types/components/collaborators-overlay/compute-selection.d.ts +24 -0
  263. package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -0
  264. package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts +72 -0
  265. package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -0
  266. package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
  267. package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
  268. package/build-types/components/collaborators-overlay/index.d.ts +7 -4
  269. package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
  270. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +6 -0
  271. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -0
  272. package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
  273. package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
  274. package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
  275. package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
  276. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +21 -5
  277. package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
  278. package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts +10 -0
  279. package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts.map +1 -0
  280. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +6 -1
  281. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
  282. package/build-types/components/collaborators-presence/avatar/component.d.ts +7 -0
  283. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -0
  284. package/build-types/components/collaborators-presence/avatar/index.d.ts +3 -0
  285. package/build-types/components/collaborators-presence/avatar/index.d.ts.map +1 -0
  286. package/build-types/components/collaborators-presence/avatar/types.d.ts +66 -0
  287. package/build-types/components/collaborators-presence/avatar/types.d.ts.map +1 -0
  288. package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts +17 -0
  289. package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts.map +1 -0
  290. package/build-types/components/collaborators-presence/avatar-group/component.d.ts +7 -0
  291. package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -0
  292. package/build-types/components/collaborators-presence/avatar-group/index.d.ts +3 -0
  293. package/build-types/components/collaborators-presence/avatar-group/index.d.ts.map +1 -0
  294. package/build-types/components/collaborators-presence/avatar-group/types.d.ts +14 -0
  295. package/build-types/components/collaborators-presence/avatar-group/types.d.ts.map +1 -0
  296. package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
  297. package/build-types/components/collaborators-presence/list.d.ts +6 -2
  298. package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
  299. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts +9 -0
  300. package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -0
  301. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  302. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  303. package/build-types/components/media/media-editor-modal.d.ts +15 -0
  304. package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
  305. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  306. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  307. package/build-types/components/post-revisions-panel/index.d.ts +2 -0
  308. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
  309. package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
  310. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  311. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +2 -5
  312. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
  313. package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -1
  314. package/build-types/components/post-revisions-preview/revisions-slider.d.ts +1 -1
  315. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  316. package/build-types/components/post-text-editor/utils.d.ts +29 -0
  317. package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
  318. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  319. package/build-types/components/provider/index.d.ts.map +1 -1
  320. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  321. package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
  322. package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
  323. package/build-types/components/provider/use-post-content-block-types.d.ts +9 -0
  324. package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -0
  325. package/build-types/components/provider/use-revision-blocks.d.ts +10 -0
  326. package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -0
  327. package/build-types/components/revision-block-diff/index.d.ts +6 -0
  328. package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
  329. package/build-types/components/revision-diff-panel/index.d.ts +14 -0
  330. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
  331. package/build-types/components/revision-fields-diff/index.d.ts +6 -0
  332. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
  333. package/build-types/components/sidebar/dataform-post-summary.d.ts +4 -0
  334. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -0
  335. package/build-types/components/sidebar/index.d.ts.map +1 -1
  336. package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
  337. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
  338. package/build-types/components/style-book/index.d.ts +2 -1
  339. package/build-types/components/style-book/index.d.ts.map +1 -1
  340. package/build-types/components/sync-connection-error-modal/index.d.ts +8 -0
  341. package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
  342. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
  343. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
  344. package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
  345. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
  346. package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
  347. package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
  348. package/build-types/components/template-actions-panel/index.d.ts +2 -0
  349. package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
  350. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  351. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
  352. package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
  353. package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
  354. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
  355. package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
  356. package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
  357. package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
  358. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  359. package/build-types/store/private-actions.d.ts +12 -0
  360. package/build-types/store/private-actions.d.ts.map +1 -1
  361. package/build-types/store/private-selectors.d.ts +45 -0
  362. package/build-types/store/private-selectors.d.ts.map +1 -1
  363. package/build-types/store/reducer.d.ts +21 -0
  364. package/build-types/store/reducer.d.ts.map +1 -1
  365. package/build-types/store/selectors.d.ts +0 -10
  366. package/build-types/store/selectors.d.ts.map +1 -1
  367. package/build-types/utils/media-delete/index.d.ts +2 -0
  368. package/build-types/utils/media-delete/index.d.ts.map +1 -0
  369. package/build-types/utils/media-finalize/index.d.ts +2 -0
  370. package/build-types/utils/media-finalize/index.d.ts.map +1 -0
  371. package/build-types/utils/media-upload/on-success.d.ts +9 -0
  372. package/build-types/utils/media-upload/on-success.d.ts.map +1 -0
  373. package/build-types/utils/sync-error-messages.d.ts +17 -3
  374. package/build-types/utils/sync-error-messages.d.ts.map +1 -1
  375. package/package.json +45 -44
  376. package/src/components/collab-sidebar/index.js +7 -4
  377. package/src/components/collab-sidebar/utils.js +9 -10
  378. package/src/components/collaborators-overlay/avatar-iframe-styles.ts +134 -0
  379. package/src/components/collaborators-overlay/collaborator-styles.ts +43 -2
  380. package/src/components/collaborators-overlay/compute-selection.ts +315 -0
  381. package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
  382. package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
  383. package/src/components/collaborators-overlay/index.tsx +12 -4
  384. package/src/components/collaborators-overlay/overlay-iframe-styles.ts +131 -0
  385. package/src/components/collaborators-overlay/overlay.tsx +145 -229
  386. package/src/components/collaborators-overlay/timing-utils.ts +30 -0
  387. package/src/components/collaborators-overlay/use-block-highlighting.ts +152 -64
  388. package/src/components/collaborators-overlay/use-debounced-recompute.ts +32 -0
  389. package/src/components/collaborators-overlay/use-render-cursors.ts +120 -282
  390. package/src/components/collaborators-presence/avatar/component.tsx +123 -0
  391. package/src/components/collaborators-presence/avatar/index.ts +2 -0
  392. package/src/components/collaborators-presence/avatar/styles.scss +184 -0
  393. package/src/components/collaborators-presence/avatar/test/index.tsx +389 -0
  394. package/src/components/collaborators-presence/avatar/types.ts +66 -0
  395. package/src/components/collaborators-presence/avatar/use-image-loading-status.ts +36 -0
  396. package/src/components/collaborators-presence/avatar-group/component.tsx +55 -0
  397. package/src/components/collaborators-presence/avatar-group/index.ts +2 -0
  398. package/src/components/collaborators-presence/avatar-group/styles.scss +33 -0
  399. package/src/components/collaborators-presence/avatar-group/test/index.tsx +139 -0
  400. package/src/components/collaborators-presence/avatar-group/types.ts +13 -0
  401. package/src/components/collaborators-presence/index.tsx +43 -12
  402. package/src/components/collaborators-presence/list.tsx +68 -40
  403. package/src/components/collaborators-presence/styles/collaborators-list.scss +26 -19
  404. package/src/components/collaborators-presence/styles/collaborators-presence.scss +6 -2
  405. package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +397 -0
  406. package/src/components/collaborators-presence/use-collaborator-notifications.ts +203 -0
  407. package/src/components/document-bar/style.scss +1 -1
  408. package/src/components/editor-interface/index.js +13 -6
  409. package/src/components/inserter-sidebar/index.js +4 -1
  410. package/src/components/post-last-revision/index.js +35 -6
  411. package/src/components/post-last-revision/style.scss +0 -3
  412. package/src/components/post-locked-modal/index.js +69 -25
  413. package/src/components/post-panel-row/style.scss +1 -0
  414. package/src/components/post-revisions-preview/block-diff.js +224 -61
  415. package/src/components/post-revisions-preview/diff-markers.js +15 -12
  416. package/src/components/post-revisions-preview/revisions-canvas.js +23 -86
  417. package/src/components/post-revisions-preview/revisions-header.js +35 -37
  418. package/src/components/post-revisions-preview/revisions-slider.js +138 -62
  419. package/src/components/post-revisions-preview/style.scss +3 -3
  420. package/src/components/post-revisions-preview/test/block-diff.js +202 -35
  421. package/src/components/preferences-modal/index.js +37 -7
  422. package/src/components/provider/disable-non-page-content-blocks.js +42 -40
  423. package/src/components/provider/index.js +20 -2
  424. package/src/components/provider/use-block-editor-settings.js +21 -1
  425. package/src/components/provider/use-post-content-block-types.js +30 -0
  426. package/src/components/provider/use-revision-blocks.js +105 -0
  427. package/src/components/revision-block-diff/index.js +39 -0
  428. package/src/components/revision-diff-panel/index.js +59 -0
  429. package/src/components/revision-diff-panel/style.scss +13 -0
  430. package/src/components/revision-fields-diff/index.js +91 -0
  431. package/src/components/sidebar/header.js +1 -1
  432. package/src/components/sidebar/index.js +4 -0
  433. package/src/components/style-book/index.js +4 -2
  434. package/src/components/sync-connection-error-modal/index.tsx +253 -0
  435. package/src/components/sync-connection-error-modal/style.scss +14 -0
  436. package/src/components/sync-connection-error-modal/use-retry-countdown.ts +93 -0
  437. package/src/components/template-content-panel/index.js +30 -38
  438. package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
  439. package/src/components/visual-editor/index.js +6 -23
  440. package/src/store/private-actions.js +70 -1
  441. package/src/store/private-selectors.js +216 -28
  442. package/src/store/reducer.js +41 -0
  443. package/src/store/selectors.js +0 -19
  444. package/src/style.scss +4 -1
  445. package/src/utils/media-finalize/index.js +11 -0
  446. package/src/utils/media-finalize/test/index.js +34 -0
  447. package/src/utils/media-upload/on-success.js +34 -0
  448. package/src/utils/sync-error-messages.ts +72 -0
  449. package/src/utils/test/sync-error-messages.js +34 -0
  450. package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
  451. package/build/components/sync-connection-modal/index.cjs +0 -130
  452. package/build/components/sync-connection-modal/index.cjs.map +0 -7
  453. package/build-module/components/provider/use-post-content-blocks.mjs +0 -34
  454. package/build-module/components/provider/use-post-content-blocks.mjs.map +0 -7
  455. package/build-module/components/sync-connection-modal/index.mjs +0 -114
  456. package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
  457. package/build-types/components/provider/use-post-content-blocks.d.ts +0 -2
  458. package/build-types/components/provider/use-post-content-blocks.d.ts.map +0 -1
  459. package/build-types/components/sync-connection-modal/index.d.ts +0 -8
  460. package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
  461. package/src/components/provider/use-post-content-blocks.js +0 -42
  462. package/src/components/sync-connection-modal/index.js +0 -140
  463. package/src/components/sync-connection-modal/style.scss +0 -11
  464. package/src/utils/sync-error-messages.js +0 -53
@@ -34,6 +34,7 @@ import { unlock } from '../../lock-unlock';
34
34
  import DisableNonPageContentBlocks from './disable-non-page-content-blocks';
35
35
  import NavigationBlockEditingMode from './navigation-block-editing-mode';
36
36
  import { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';
37
+ import { useRevisionBlocks } from './use-revision-blocks';
37
38
  import useCommands from '../commands';
38
39
  import useUploadSaveLock from './use-upload-save-lock';
39
40
  import BlockRemovalWarnings from '../block-removal-warnings';
@@ -78,6 +79,7 @@ const NON_CONTEXTUAL_POST_TYPES = [
78
79
  * @return {Array} Block editor props.
79
80
  */
80
81
  function useBlockEditorProps( post, template, mode ) {
82
+ const revisionBlocks = useRevisionBlocks();
81
83
  const rootLevelPost = mode === 'template-locked' ? 'template' : 'post';
82
84
  const [ postBlocks, onInput, onChange ] = useEntityBlockEditor(
83
85
  'postType',
@@ -116,6 +118,11 @@ function useBlockEditorProps( post, template, mode ) {
116
118
  return postBlocks;
117
119
  }, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );
118
120
 
121
+ // In revisions mode, use the revision blocks and disable editing.
122
+ if ( revisionBlocks !== null ) {
123
+ return [ revisionBlocks, noop, noop ];
124
+ }
125
+
119
126
  // Handle fallback to postBlocks outside of the above useMemo, to ensure
120
127
  // that constructed block templates that call `createBlock` are not generated
121
128
  // too frequently. This ensures that clientIds are stable.
@@ -177,6 +184,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
177
184
  mode,
178
185
  defaultMode,
179
186
  postTypeEntities,
187
+ isInRevisionsMode,
188
+ currentRevisionId,
180
189
  } = useSelect(
181
190
  ( select ) => {
182
191
  const {
@@ -184,6 +193,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
184
193
  getRenderingMode,
185
194
  __unstableIsEditorReady,
186
195
  getDefaultRenderingMode,
196
+ isRevisionsMode: _isRevisionsMode,
197
+ getCurrentRevisionId: _getCurrentRevisionId,
187
198
  } = unlock( select( editorStore ) );
188
199
  const { getEntitiesConfig, getEntityRecordEdits } =
189
200
  select( coreStore );
@@ -224,6 +235,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
224
235
  post.type === 'wp_template'
225
236
  ? getEntitiesConfig( 'postType' )
226
237
  : null,
238
+ isInRevisionsMode: _isRevisionsMode(),
239
+ currentRevisionId: _getCurrentRevisionId(),
227
240
  };
228
241
  },
229
242
  [ post.type, post.id, hasTemplate ]
@@ -418,14 +431,19 @@ export const ExperimentalEditorProvider = withRegistryProvider(
418
431
  kind="postType"
419
432
  type={ post.type }
420
433
  id={ post.id }
434
+ revisionId={ currentRevisionId ?? undefined }
421
435
  >
422
436
  <BlockContextProvider value={ defaultBlockContext }>
423
437
  <BlockEditorProviderComponent
424
438
  value={ blocks }
425
439
  onChange={ onChange }
426
440
  onInput={ onInput }
427
- selection={ selection }
428
- onChangeSelection={ onChangeSelection }
441
+ selection={
442
+ isInRevisionsMode ? undefined : selection
443
+ }
444
+ onChangeSelection={
445
+ isInRevisionsMode ? noop : onChangeSelection
446
+ }
429
447
  settings={ blockEditorSettings }
430
448
  useSubRegistry={ false }
431
449
  >
@@ -23,7 +23,9 @@ import {
23
23
  */
24
24
  import inserterMediaCategories from '../media-categories';
25
25
  import { mediaUpload } from '../../utils';
26
+ import mediaUploadOnSuccess from '../../utils/media-upload/on-success';
26
27
  import { default as mediaSideload } from '../../utils/media-sideload';
28
+ import { default as mediaFinalize } from '../../utils/media-finalize';
27
29
  import { store as editorStore } from '../../store';
28
30
  import { unlock } from '../../lock-unlock';
29
31
  import { useGlobalStylesContext } from '../global-styles-provider';
@@ -103,6 +105,7 @@ const {
103
105
  isIsolatedEditorKey,
104
106
  deviceTypeKey,
105
107
  isNavigationOverlayContextKey,
108
+ mediaUploadOnSuccessKey,
106
109
  } = unlock( privateApis );
107
110
 
108
111
  /**
@@ -137,6 +140,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
137
140
  sectionRootClientId,
138
141
  deviceType,
139
142
  isNavigationOverlayContext,
143
+ isRevisionsMode,
140
144
  } = useSelect(
141
145
  ( select ) => {
142
146
  const {
@@ -148,7 +152,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
148
152
  } = select( coreStore );
149
153
  const { get } = select( preferencesStore );
150
154
  const { getBlockTypes } = select( blocksStore );
151
- const { getDeviceType } = unlock( select( editorStore ) );
155
+ const { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(
156
+ select( editorStore )
157
+ );
152
158
  const { getBlocksByName, getBlockAttributes } =
153
159
  select( blockEditorStore );
154
160
  const siteSettings = canUser( 'read', {
@@ -216,6 +222,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
216
222
  postId
217
223
  )?.area === 'navigation-overlay'
218
224
  : false,
225
+ isRevisionsMode: _isRevisionsMode(),
219
226
  };
220
227
  },
221
228
  [ postType, postId, isLargeViewport, renderingMode ]
@@ -336,7 +343,11 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
336
343
  ? editMediaEntity
337
344
  : undefined,
338
345
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
346
+ [ mediaUploadOnSuccessKey ]: hasUploadPermissions
347
+ ? mediaUploadOnSuccess
348
+ : undefined,
339
349
  mediaSideload: hasUploadPermissions ? mediaSideload : undefined,
350
+ mediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,
340
351
  __experimentalBlockPatterns: blockPatterns,
341
352
  [ selectBlockPatternsKey ]: ( select ) => {
342
353
  const { hasFinishedResolution, getBlockPatternsForPostType } =
@@ -386,12 +397,21 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
386
397
  'wp_block',
387
398
  'wp_navigation',
388
399
  ].includes( postType ),
400
+ // When in template-locked mode (e.g., "Show Template" in the post editor),
401
+ // don't treat template parts as contentOnly sections.
402
+ disableContentOnlyForTemplateParts:
403
+ renderingMode === 'template-locked',
389
404
  ...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),
390
405
  [ isNavigationOverlayContextKey ]: isNavigationOverlayContext,
391
406
  };
392
407
 
408
+ if ( isRevisionsMode ) {
409
+ blockEditorSettings.isPreviewMode = true;
410
+ }
411
+
393
412
  return blockEditorSettings;
394
413
  }, [
414
+ isRevisionsMode,
395
415
  allowedBlockTypes,
396
416
  allowRightClickOverrides,
397
417
  focusMode,
@@ -0,0 +1,30 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useMemo } from '@wordpress/element';
5
+ import { applyFilters } from '@wordpress/hooks';
6
+
7
+ const POST_CONTENT_BLOCK_TYPES = [
8
+ 'core/post-title',
9
+ 'core/post-featured-image',
10
+ 'core/post-content',
11
+ ];
12
+
13
+ /**
14
+ * Returns the list of post content block types, including any added via the
15
+ * `editor.postContentBlockTypes` filter. The result is memoized so it can be
16
+ * used as a stable dependency in `useSelect` calls.
17
+ *
18
+ * @return {string[]} Block type names considered post content.
19
+ */
20
+ export default function usePostContentBlockTypes() {
21
+ return useMemo(
22
+ () => [
23
+ ...applyFilters(
24
+ 'editor.postContentBlockTypes',
25
+ POST_CONTENT_BLOCK_TYPES
26
+ ),
27
+ ],
28
+ []
29
+ );
30
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { useMemo, useRef } from '@wordpress/element';
6
+ import { createBlock, parse } from '@wordpress/blocks';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editorStore } from '../../store';
12
+ import { unlock } from '../../lock-unlock';
13
+ import { diffRevisionContent } from '../post-revisions-preview/block-diff';
14
+ import { preserveClientIds } from '../post-revisions-preview/preserve-client-ids';
15
+
16
+ /**
17
+ * Hook that computes revision blocks when in revisions mode.
18
+ *
19
+ * Returns `null` when not in revisions mode, `[]` when loading,
20
+ * or the computed blocks array when ready.
21
+ *
22
+ * @return {Array|null} The revision blocks, or null if not in revisions mode.
23
+ */
24
+ export function useRevisionBlocks() {
25
+ const {
26
+ isInRevisionsMode,
27
+ showDiff,
28
+ revision,
29
+ previousRevision,
30
+ postType,
31
+ } = useSelect( ( select ) => {
32
+ const {
33
+ isRevisionsMode,
34
+ isShowingRevisionDiff,
35
+ getCurrentRevision,
36
+ getPreviousRevision,
37
+ } = unlock( select( editorStore ) );
38
+ const { getCurrentPostType } = select( editorStore );
39
+
40
+ const inRevisions = isRevisionsMode();
41
+ return {
42
+ isInRevisionsMode: inRevisions,
43
+ showDiff: isShowingRevisionDiff(),
44
+ revision: inRevisions ? getCurrentRevision() : undefined,
45
+ previousRevision: inRevisions ? getPreviousRevision() : undefined,
46
+ postType: getCurrentPostType(),
47
+ };
48
+ }, [] );
49
+
50
+ // Track previously rendered blocks to preserve clientIds between renders.
51
+ const previousBlocksRef = useRef( [] );
52
+
53
+ const blocks = useMemo( () => {
54
+ if ( ! isInRevisionsMode ) {
55
+ // Clear the ref when exiting revisions mode.
56
+ previousBlocksRef.current = [];
57
+ return null;
58
+ }
59
+
60
+ // Revision not loaded yet.
61
+ if ( ! revision ) {
62
+ return [];
63
+ }
64
+
65
+ const currentContent = revision?.content?.raw ?? '';
66
+
67
+ let parsedBlocks;
68
+ if ( showDiff ) {
69
+ const previousContent = previousRevision?.content?.raw || '';
70
+ parsedBlocks = diffRevisionContent(
71
+ currentContent,
72
+ previousContent
73
+ );
74
+ } else {
75
+ parsedBlocks = parse( currentContent );
76
+ }
77
+
78
+ if ( postType === 'wp_navigation' ) {
79
+ parsedBlocks = [
80
+ createBlock(
81
+ 'core/navigation',
82
+ { templateLock: false },
83
+ parsedBlocks
84
+ ),
85
+ ];
86
+ }
87
+
88
+ const blocksWithStableIds = preserveClientIds(
89
+ parsedBlocks,
90
+ previousBlocksRef.current
91
+ );
92
+ previousBlocksRef.current = blocksWithStableIds;
93
+
94
+ return blocksWithStableIds;
95
+ }, [
96
+ isInRevisionsMode,
97
+ revision,
98
+ revision?.content?.raw,
99
+ previousRevision?.content?.raw,
100
+ postType,
101
+ showDiff,
102
+ ] );
103
+
104
+ return blocks;
105
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import RevisionDiffPanel from '../revision-diff-panel';
12
+
13
+ /**
14
+ * Panel that shows changed block attributes for the selected block
15
+ * when viewing revisions.
16
+ */
17
+ export default function RevisionBlockDiffPanel() {
18
+ const { block } = useSelect( ( select ) => {
19
+ const { getSelectedBlock } = select( blockEditorStore );
20
+ return {
21
+ block: getSelectedBlock(),
22
+ };
23
+ }, [] );
24
+
25
+ if ( ! block ) {
26
+ return null;
27
+ }
28
+
29
+ const changedAttributes =
30
+ block.attributes?.__revisionDiffStatus?.changedAttributes;
31
+
32
+ return (
33
+ <RevisionDiffPanel
34
+ title={ __( 'Changed attributes' ) }
35
+ entries={ changedAttributes }
36
+ initialOpen
37
+ />
38
+ );
39
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelBody } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostPanelRow from '../post-panel-row';
10
+
11
+ /**
12
+ * Renders a panel of word-level diffs.
13
+ *
14
+ * @param {Object} props
15
+ * @param {string} props.title Panel title.
16
+ * @param {Object} props.entries Map of key → diffWords parts arrays.
17
+ * @param {boolean} props.initialOpen Whether the panel starts open.
18
+ */
19
+ export default function RevisionDiffPanel( { title, entries, initialOpen } ) {
20
+ if ( ! entries ) {
21
+ return null;
22
+ }
23
+
24
+ const fields = Object.entries( entries ).map( ( [ key, parts ] ) => (
25
+ <PostPanelRow key={ key } label={ key }>
26
+ <span className="editor-revision-fields-diff__value">
27
+ { parts.map( ( part, index ) => {
28
+ if ( part.added ) {
29
+ return (
30
+ <ins
31
+ key={ index }
32
+ className="editor-revision-fields-diff__added"
33
+ >
34
+ { part.value }
35
+ </ins>
36
+ );
37
+ }
38
+ if ( part.removed ) {
39
+ return (
40
+ <del
41
+ key={ index }
42
+ className="editor-revision-fields-diff__removed"
43
+ >
44
+ { part.value }
45
+ </del>
46
+ );
47
+ }
48
+ return <span key={ index }>{ part.value }</span>;
49
+ } ) }
50
+ </span>
51
+ </PostPanelRow>
52
+ ) );
53
+
54
+ return (
55
+ <PanelBody title={ title } initialOpen={ initialOpen }>
56
+ { fields }
57
+ </PanelBody>
58
+ );
59
+ }
@@ -0,0 +1,13 @@
1
+ .editor-revision-fields-diff__value {
2
+ word-break: break-word;
3
+ }
4
+
5
+ .editor-revision-fields-diff__added {
6
+ background-color: color-mix(in srgb, currentColor 5%, #00a32a 15%);
7
+ text-decoration: none;
8
+ }
9
+
10
+ .editor-revision-fields-diff__removed {
11
+ text-decoration: line-through;
12
+ color: #d63638;
13
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { diffWords } from 'diff/lib/diff/word';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useSelect } from '@wordpress/data';
10
+ import { useMemo } from '@wordpress/element';
11
+ import { __ } from '@wordpress/i18n';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import RevisionDiffPanel from '../revision-diff-panel';
17
+ import { store as editorStore } from '../../store';
18
+ import { unlock } from '../../lock-unlock';
19
+
20
+ /**
21
+ * Safely stringifies a value for display and comparison.
22
+ *
23
+ * @param {*} value The value to stringify.
24
+ * @return {string} The stringified value.
25
+ */
26
+ function stringifyValue( value ) {
27
+ if ( value === null || value === undefined ) {
28
+ return '';
29
+ }
30
+ if ( typeof value === 'object' ) {
31
+ return JSON.stringify( value, null, 2 );
32
+ }
33
+ return String( value );
34
+ }
35
+
36
+ /**
37
+ * Panel that shows meta field diffs between the current revision and
38
+ * the previous revision in the document sidebar during revision mode.
39
+ */
40
+ export default function RevisionFieldsDiffPanel() {
41
+ const { revision, previousRevision } = useSelect( ( select ) => {
42
+ const { getCurrentRevision, getPreviousRevision } = unlock(
43
+ select( editorStore )
44
+ );
45
+
46
+ return {
47
+ revision: getCurrentRevision(),
48
+ previousRevision: getPreviousRevision(),
49
+ };
50
+ }, [] );
51
+
52
+ const entries = useMemo( () => {
53
+ if ( ! revision ) {
54
+ return null;
55
+ }
56
+
57
+ const revisionMeta = revision.meta ?? {};
58
+ const previousMeta = previousRevision?.meta ?? {};
59
+ const allMetaKeys = new Set( [
60
+ ...Object.keys( revisionMeta ),
61
+ ...Object.keys( previousMeta ),
62
+ ] );
63
+
64
+ const result = {};
65
+
66
+ for ( const key of allMetaKeys ) {
67
+ const revStr = stringifyValue( revisionMeta[ key ] );
68
+ const prevStr = stringifyValue( previousMeta[ key ] );
69
+
70
+ if ( ! revStr && ! prevStr ) {
71
+ continue;
72
+ }
73
+
74
+ result[ key ] = diffWords( prevStr, revStr );
75
+ }
76
+
77
+ if ( Object.keys( result ).length === 0 ) {
78
+ return null;
79
+ }
80
+
81
+ return result;
82
+ }, [ revision, previousRevision ] );
83
+
84
+ return (
85
+ <RevisionDiffPanel
86
+ title={ __( 'Meta' ) }
87
+ entries={ entries }
88
+ initialOpen={ false }
89
+ />
90
+ );
91
+ }
@@ -55,7 +55,7 @@ const SidebarHeader = ( _, ref ) => {
55
55
  >
56
56
  { documentLabel }
57
57
  </Tabs.Tab>
58
- { ! isAttachment && ! isRevisionsMode && (
58
+ { ! isAttachment && (
59
59
  <Tabs.Tab
60
60
  tabId={ sidebars.block }
61
61
  // Used for focus management in the SettingsSidebar component.
@@ -27,11 +27,13 @@ import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
27
27
  import PluginSidebar from '../plugin-sidebar';
28
28
  import PostSummary from './post-summary';
29
29
  import PostTaxonomiesPanel from '../post-taxonomies/panel';
30
+ import RevisionFieldsDiffPanel from '../revision-fields-diff';
30
31
  import PostTransformPanel from '../post-transform-panel';
31
32
  import SidebarHeader from './header';
32
33
  import TemplateContentPanel from '../template-content-panel';
33
34
  import TemplatePartContentPanel from '../template-part-content-panel';
34
35
  import { MediaMetadataPanel } from '../media';
36
+ import RevisionBlockDiffPanel from '../revision-block-diff';
35
37
  import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
36
38
  import { sidebars } from './constants';
37
39
  import { unlock } from '../../lock-unlock';
@@ -127,6 +129,7 @@ const SidebarContent = ( {
127
129
  <PostSummary
128
130
  onActionPerformed={ onActionPerformed }
129
131
  />
132
+ { isRevisionsMode && <RevisionFieldsDiffPanel /> }
130
133
  { ! isRevisionsMode && (
131
134
  <>
132
135
  <PluginDocumentSettingPanel.Slot />
@@ -144,6 +147,7 @@ const SidebarContent = ( {
144
147
  { ! isAttachment && (
145
148
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
146
149
  <BlockInspector />
150
+ { isRevisionsMode && <RevisionBlockDiffPanel /> }
147
151
  </Tabs.TabPanel>
148
152
  ) }
149
153
  </Tabs.Context.Provider>
@@ -375,6 +375,7 @@ function StyleBook(
375
375
  * @param {Function} props.onPathChange Callback when the path changes.
376
376
  * @param {Object} props.userConfig User configuration.
377
377
  * @param {boolean} props.isStatic Whether the stylebook is static or clickable.
378
+ * @param {Object} props.settings Optional editor settings to use instead of the editor store settings.
378
379
  * @return {Object} Style Book Preview component.
379
380
  */
380
381
  export const StyleBookPreview = ( {
@@ -382,10 +383,11 @@ export const StyleBookPreview = ( {
382
383
  isStatic = false,
383
384
  path,
384
385
  onPathChange,
386
+ settings: settingsProp,
385
387
  } ) => {
386
388
  const editorSettings = useSelect(
387
- ( select ) => select( editorStore ).getEditorSettings(),
388
- []
389
+ ( select ) => settingsProp ?? select( editorStore ).getEditorSettings(),
390
+ [ settingsProp ]
389
391
  );
390
392
 
391
393
  const canUserUploadMedia = useSelect(