@wordpress/editor 14.48.1 → 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 (401) hide show
  1. package/build/bindings/pattern-overrides.cjs +1 -1
  2. package/build/bindings/pattern-overrides.cjs.map +2 -2
  3. package/build/components/collab-sidebar/note-byline.cjs +1 -1
  4. package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
  5. package/build/components/collab-sidebar/note.cjs +49 -17
  6. package/build/components/collab-sidebar/note.cjs.map +3 -3
  7. package/build/components/collab-sidebar/notes.cjs.map +1 -1
  8. package/build/components/collab-sidebar/utils.cjs +1 -1
  9. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  10. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +1 -1
  11. package/build/components/collaborators-overlay/collaborator-styles.cjs.map +1 -1
  12. package/build/components/collaborators-overlay/compute-selection.cjs.map +1 -1
  13. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
  14. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +1 -1
  15. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +1 -1
  16. package/build/components/collaborators-presence/avatar/component.cjs.map +2 -2
  17. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +1 -1
  18. package/build/components/document-bar/index.cjs +7 -5
  19. package/build/components/document-bar/index.cjs.map +2 -2
  20. package/build/components/global-keyboard-shortcuts/index.cjs +3 -2
  21. package/build/components/global-keyboard-shortcuts/index.cjs.map +2 -2
  22. package/build/components/global-styles-sidebar/welcome-guide.cjs +3 -3
  23. package/build/components/global-styles-sidebar/welcome-guide.cjs.map +1 -1
  24. package/build/components/local-autosave-monitor/index.cjs +14 -15
  25. package/build/components/local-autosave-monitor/index.cjs.map +2 -2
  26. package/build/components/page-attributes/parent.cjs +1 -1
  27. package/build/components/page-attributes/parent.cjs.map +2 -2
  28. package/build/components/post-card-panel/index.cjs +1 -1
  29. package/build/components/post-card-panel/index.cjs.map +2 -2
  30. package/build/components/post-excerpt/panel.cjs +1 -1
  31. package/build/components/post-excerpt/panel.cjs.map +2 -2
  32. package/build/components/post-locked-modal/index.cjs +3 -3
  33. package/build/components/post-locked-modal/index.cjs.map +1 -1
  34. package/build/components/post-preview-button/index.cjs +2 -2
  35. package/build/components/post-preview-button/index.cjs.map +2 -2
  36. package/build/components/post-publish-button/index.cjs +4 -3
  37. package/build/components/post-publish-button/index.cjs.map +2 -2
  38. package/build/components/post-publish-button/label.cjs +2 -2
  39. package/build/components/post-publish-button/label.cjs.map +2 -2
  40. package/build/components/post-publish-panel/index.cjs.map +1 -1
  41. package/build/components/post-publish-panel/postpublish.cjs +1 -1
  42. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  43. package/build/components/post-revisions-preview/block-diff.cjs.map +1 -1
  44. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  45. package/build/components/post-revisions-preview/revisions-slider.cjs +1 -1
  46. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  47. package/build/components/post-revisions-timeline/index.cjs +173 -0
  48. package/build/components/post-revisions-timeline/index.cjs.map +7 -0
  49. package/build/components/post-saved-state/index.cjs +17 -26
  50. package/build/components/post-saved-state/index.cjs.map +2 -2
  51. package/build/components/post-schedule/label.cjs +5 -5
  52. package/build/components/post-schedule/label.cjs.map +1 -1
  53. package/build/components/post-taxonomies/flat-term-selector.cjs +2 -1
  54. package/build/components/post-taxonomies/flat-term-selector.cjs.map +3 -3
  55. package/build/components/post-taxonomies/hierarchical-term-selector.cjs +1 -1
  56. package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
  57. package/build/components/post-text-editor/index.cjs +51 -0
  58. package/build/components/post-text-editor/index.cjs.map +2 -2
  59. package/build/components/post-text-editor/utils.cjs +150 -0
  60. package/build/components/post-text-editor/utils.cjs.map +7 -0
  61. package/build/components/post-url/index.cjs +1 -1
  62. package/build/components/post-url/index.cjs.map +2 -2
  63. package/build/components/post-view-link/index.cjs +1 -1
  64. package/build/components/post-view-link/index.cjs.map +2 -2
  65. package/build/components/provider/disable-non-page-content-blocks.cjs.map +1 -1
  66. package/build/components/provider/index.cjs +1 -1
  67. package/build/components/provider/index.cjs.map +2 -2
  68. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  69. package/build/components/revision-diff-panel/index.cjs +7 -2
  70. package/build/components/revision-diff-panel/index.cjs.map +2 -2
  71. package/build/components/revision-fields-diff/index.cjs +6 -2
  72. package/build/components/revision-fields-diff/index.cjs.map +2 -2
  73. package/build/components/sidebar/dataform-post-summary.cjs +125 -20
  74. package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
  75. package/build/components/sidebar/index.cjs +1 -11
  76. package/build/components/sidebar/index.cjs.map +3 -3
  77. package/build/components/sidebar/post-revision-summary.cjs +11 -17
  78. package/build/components/sidebar/post-revision-summary.cjs.map +3 -3
  79. package/build/components/sidebar/post-summary.cjs +1 -1
  80. package/build/components/sidebar/post-summary.cjs.map +2 -2
  81. package/build/components/style-book/examples.cjs +1 -1
  82. package/build/components/style-book/examples.cjs.map +1 -1
  83. package/build/components/style-book/index.cjs +1 -1
  84. package/build/components/style-book/index.cjs.map +2 -2
  85. package/build/components/sync-connection-error-modal/index.cjs +3 -3
  86. package/build/components/sync-connection-error-modal/index.cjs.map +1 -1
  87. package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
  88. package/build/components/template-actions-panel/index.cjs +0 -9
  89. package/build/components/template-actions-panel/index.cjs.map +3 -3
  90. package/build/components/template-validation-notice/index.cjs +1 -1
  91. package/build/components/template-validation-notice/index.cjs.map +1 -1
  92. package/build/components/upload-progress-snackbar/index.cjs +3 -3
  93. package/build/components/upload-progress-snackbar/index.cjs.map +2 -2
  94. package/build/components/upload-progress-snackbar/tracker.cjs.map +1 -1
  95. package/build/components/visual-editor/edit-template-blocks-notification.cjs +1 -1
  96. package/build/components/visual-editor/edit-template-blocks-notification.cjs.map +1 -1
  97. package/build/{components/revision-author-panel → dataviews/fields/revisions}/index.cjs +18 -26
  98. package/build/dataviews/fields/revisions/index.cjs.map +7 -0
  99. package/build/dataviews/fields/revisions/revisions-view.cjs +74 -0
  100. package/build/dataviews/fields/revisions/revisions-view.cjs.map +7 -0
  101. package/build/dataviews/store/private-actions.cjs +14 -4
  102. package/build/dataviews/store/private-actions.cjs.map +3 -3
  103. package/build/hooks/push-changes-to-global-styles/index.cjs +1 -1
  104. package/build/hooks/push-changes-to-global-styles/index.cjs.map +1 -1
  105. package/build/store/actions.cjs +1 -1
  106. package/build/store/actions.cjs.map +2 -2
  107. package/build/store/private-selectors.cjs +6 -1
  108. package/build/store/private-selectors.cjs.map +2 -2
  109. package/build/utils/media-upload/index.cjs.map +1 -1
  110. package/build/utils/set-nested-value.cjs.map +1 -1
  111. package/build-module/bindings/pattern-overrides.mjs +1 -1
  112. package/build-module/bindings/pattern-overrides.mjs.map +2 -2
  113. package/build-module/components/collab-sidebar/note-byline.mjs +1 -1
  114. package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
  115. package/build-module/components/collab-sidebar/note.mjs +50 -18
  116. package/build-module/components/collab-sidebar/note.mjs.map +2 -2
  117. package/build-module/components/collab-sidebar/notes.mjs.map +1 -1
  118. package/build-module/components/collab-sidebar/utils.mjs +1 -1
  119. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  120. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +1 -1
  121. package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +1 -1
  122. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +1 -1
  123. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
  124. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +1 -1
  125. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +1 -1
  126. package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
  127. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +1 -1
  128. package/build-module/components/document-bar/index.mjs +7 -5
  129. package/build-module/components/document-bar/index.mjs.map +2 -2
  130. package/build-module/components/global-keyboard-shortcuts/index.mjs +3 -2
  131. package/build-module/components/global-keyboard-shortcuts/index.mjs.map +2 -2
  132. package/build-module/components/global-styles-sidebar/welcome-guide.mjs +3 -3
  133. package/build-module/components/global-styles-sidebar/welcome-guide.mjs.map +1 -1
  134. package/build-module/components/local-autosave-monitor/index.mjs +15 -16
  135. package/build-module/components/local-autosave-monitor/index.mjs.map +2 -2
  136. package/build-module/components/page-attributes/parent.mjs +1 -1
  137. package/build-module/components/page-attributes/parent.mjs.map +2 -2
  138. package/build-module/components/post-card-panel/index.mjs +1 -1
  139. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  140. package/build-module/components/post-excerpt/panel.mjs +1 -1
  141. package/build-module/components/post-excerpt/panel.mjs.map +2 -2
  142. package/build-module/components/post-locked-modal/index.mjs +3 -3
  143. package/build-module/components/post-locked-modal/index.mjs.map +1 -1
  144. package/build-module/components/post-preview-button/index.mjs +2 -2
  145. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  146. package/build-module/components/post-publish-button/index.mjs +4 -3
  147. package/build-module/components/post-publish-button/index.mjs.map +2 -2
  148. package/build-module/components/post-publish-button/label.mjs +2 -2
  149. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  150. package/build-module/components/post-publish-panel/index.mjs.map +1 -1
  151. package/build-module/components/post-publish-panel/postpublish.mjs +1 -1
  152. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  153. package/build-module/components/post-revisions-preview/block-diff.mjs.map +1 -1
  154. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  155. package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -1
  156. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  157. package/build-module/components/post-revisions-timeline/index.mjs +152 -0
  158. package/build-module/components/post-revisions-timeline/index.mjs.map +7 -0
  159. package/build-module/components/post-saved-state/index.mjs +17 -26
  160. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  161. package/build-module/components/post-schedule/label.mjs +5 -5
  162. package/build-module/components/post-schedule/label.mjs.map +1 -1
  163. package/build-module/components/post-taxonomies/flat-term-selector.mjs +3 -6
  164. package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
  165. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +1 -1
  166. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
  167. package/build-module/components/post-text-editor/index.mjs +51 -0
  168. package/build-module/components/post-text-editor/index.mjs.map +2 -2
  169. package/build-module/components/post-text-editor/utils.mjs +123 -0
  170. package/build-module/components/post-text-editor/utils.mjs.map +7 -0
  171. package/build-module/components/post-url/index.mjs +1 -1
  172. package/build-module/components/post-url/index.mjs.map +2 -2
  173. package/build-module/components/post-view-link/index.mjs +1 -1
  174. package/build-module/components/post-view-link/index.mjs.map +2 -2
  175. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +1 -1
  176. package/build-module/components/provider/index.mjs +1 -1
  177. package/build-module/components/provider/index.mjs.map +2 -2
  178. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  179. package/build-module/components/revision-diff-panel/index.mjs +7 -2
  180. package/build-module/components/revision-diff-panel/index.mjs.map +2 -2
  181. package/build-module/components/revision-fields-diff/index.mjs +6 -2
  182. package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
  183. package/build-module/components/sidebar/dataform-post-summary.mjs +125 -20
  184. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  185. package/build-module/components/sidebar/index.mjs +1 -11
  186. package/build-module/components/sidebar/index.mjs.map +2 -2
  187. package/build-module/components/sidebar/post-revision-summary.mjs +11 -17
  188. package/build-module/components/sidebar/post-revision-summary.mjs.map +2 -2
  189. package/build-module/components/sidebar/post-summary.mjs +1 -1
  190. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  191. package/build-module/components/style-book/examples.mjs +1 -1
  192. package/build-module/components/style-book/examples.mjs.map +1 -1
  193. package/build-module/components/style-book/index.mjs +1 -1
  194. package/build-module/components/style-book/index.mjs.map +2 -2
  195. package/build-module/components/sync-connection-error-modal/index.mjs +3 -3
  196. package/build-module/components/sync-connection-error-modal/index.mjs.map +1 -1
  197. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
  198. package/build-module/components/template-actions-panel/index.mjs +0 -9
  199. package/build-module/components/template-actions-panel/index.mjs.map +2 -2
  200. package/build-module/components/template-validation-notice/index.mjs +1 -1
  201. package/build-module/components/template-validation-notice/index.mjs.map +1 -1
  202. package/build-module/components/upload-progress-snackbar/index.mjs +3 -3
  203. package/build-module/components/upload-progress-snackbar/index.mjs.map +2 -2
  204. package/build-module/components/upload-progress-snackbar/tracker.mjs.map +1 -1
  205. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs +1 -1
  206. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs.map +1 -1
  207. package/build-module/dataviews/fields/revisions/index.mjs +20 -0
  208. package/build-module/dataviews/fields/revisions/index.mjs.map +7 -0
  209. package/build-module/dataviews/fields/revisions/revisions-view.mjs +53 -0
  210. package/build-module/dataviews/fields/revisions/revisions-view.mjs.map +7 -0
  211. package/build-module/dataviews/store/private-actions.mjs +23 -7
  212. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  213. package/build-module/hooks/push-changes-to-global-styles/index.mjs +1 -1
  214. package/build-module/hooks/push-changes-to-global-styles/index.mjs.map +1 -1
  215. package/build-module/store/actions.mjs +1 -1
  216. package/build-module/store/actions.mjs.map +2 -2
  217. package/build-module/store/private-selectors.mjs +7 -1
  218. package/build-module/store/private-selectors.mjs.map +2 -2
  219. package/build-module/utils/media-upload/index.mjs.map +1 -1
  220. package/build-module/utils/set-nested-value.mjs.map +1 -1
  221. package/build-style/style-rtl.css +270 -206
  222. package/build-style/style.css +270 -206
  223. package/build-types/components/collab-sidebar/note-byline.d.ts +0 -3
  224. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
  225. package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
  226. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
  227. package/build-types/components/document-bar/index.d.ts +2 -2
  228. package/build-types/components/document-bar/index.d.ts.map +1 -1
  229. package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
  230. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  231. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  232. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  233. package/build-types/components/post-revisions-timeline/index.d.ts +2 -0
  234. package/build-types/components/post-revisions-timeline/index.d.ts.map +1 -0
  235. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  236. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  237. package/build-types/components/post-text-editor/index.d.ts +1 -1
  238. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  239. package/build-types/components/provider/index.d.ts.map +1 -1
  240. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  241. package/build-types/components/revision-diff-panel/index.d.ts +3 -1
  242. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
  243. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
  244. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  245. package/build-types/components/sidebar/index.d.ts.map +1 -1
  246. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
  247. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
  248. package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
  249. package/build-types/dataviews/fields/revisions/index.d.ts +8 -0
  250. package/build-types/dataviews/fields/revisions/index.d.ts.map +1 -0
  251. package/build-types/dataviews/fields/revisions/revisions-view.d.ts +2 -0
  252. package/build-types/dataviews/fields/revisions/revisions-view.d.ts.map +1 -0
  253. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  254. package/build-types/store/private-selectors.d.ts +1 -1
  255. package/build-types/store/private-selectors.d.ts.map +1 -1
  256. package/build-types/store/selectors.d.ts +1 -1
  257. package/build-types/store/selectors.d.ts.map +1 -1
  258. package/package.json +53 -47
  259. package/src/bindings/pattern-overrides.js +1 -1
  260. package/src/bindings/test/pattern-overrides.js +65 -0
  261. package/src/components/collab-sidebar/note-byline.js +0 -1
  262. package/src/components/collab-sidebar/note.js +64 -29
  263. package/src/components/collab-sidebar/style.scss +20 -0
  264. package/src/components/collaborators-presence/avatar/component.tsx +0 -1
  265. package/src/components/collaborators-presence/avatar/test/index.tsx +0 -1
  266. package/src/components/document-bar/index.js +8 -3
  267. package/src/components/document-bar/style.scss +4 -2
  268. package/src/components/global-keyboard-shortcuts/index.js +2 -1
  269. package/src/components/local-autosave-monitor/index.js +23 -21
  270. package/src/components/post-card-panel/index.js +1 -1
  271. package/src/components/post-publish-button/index.js +6 -3
  272. package/src/components/post-publish-button/test/index.js +13 -0
  273. package/src/components/post-revisions-preview/diff-markers.js +0 -1
  274. package/src/components/post-revisions-timeline/index.js +186 -0
  275. package/src/components/post-revisions-timeline/style.scss +43 -0
  276. package/src/components/post-saved-state/index.js +23 -26
  277. package/src/components/post-saved-state/test/index.js +18 -0
  278. package/src/components/post-taxonomies/flat-term-selector.js +4 -7
  279. package/src/components/post-text-editor/index.js +65 -0
  280. package/src/components/post-text-editor/test/utils.js +210 -0
  281. package/src/components/post-text-editor/utils.js +204 -0
  282. package/src/components/post-type-support-check/test/index.js +11 -0
  283. package/src/components/post-url/index.js +1 -1
  284. package/src/components/post-view-link/index.js +1 -1
  285. package/src/components/post-view-link/test/index.js +71 -0
  286. package/src/components/provider/index.js +2 -1
  287. package/src/components/resizable-editor/resize-handle.js +0 -1
  288. package/src/components/revision-diff-panel/index.js +8 -2
  289. package/src/components/revision-fields-diff/index.js +12 -1
  290. package/src/components/sidebar/dataform-post-summary.js +196 -25
  291. package/src/components/sidebar/index.js +2 -12
  292. package/src/components/sidebar/post-revision-summary.js +8 -15
  293. package/src/components/sidebar/post-summary.js +1 -1
  294. package/src/components/style-book/index.js +1 -1
  295. package/src/components/template-actions-panel/block-theme-content.js +0 -1
  296. package/src/components/template-actions-panel/index.js +0 -15
  297. package/src/dataviews/fields/revisions/index.tsx +28 -0
  298. package/src/dataviews/fields/revisions/revisions-view.tsx +59 -0
  299. package/src/dataviews/store/private-actions.ts +27 -6
  300. package/src/store/private-selectors.js +11 -1
  301. package/src/store/test/private-selectors.js +69 -0
  302. package/src/style.scss +1 -1
  303. package/build/components/post-revisions-panel/index.cjs +0 -173
  304. package/build/components/post-revisions-panel/index.cjs.map +0 -7
  305. package/build/components/revision-author-panel/index.cjs.map +0 -7
  306. package/build/components/revision-created-panel/index.cjs +0 -47
  307. package/build/components/revision-created-panel/index.cjs.map +0 -7
  308. package/build-module/components/post-revisions-panel/index.mjs +0 -148
  309. package/build-module/components/post-revisions-panel/index.mjs.map +0 -7
  310. package/build-module/components/revision-author-panel/index.mjs +0 -28
  311. package/build-module/components/revision-author-panel/index.mjs.map +0 -7
  312. package/build-module/components/revision-created-panel/index.mjs +0 -26
  313. package/build-module/components/revision-created-panel/index.mjs.map +0 -7
  314. package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
  315. package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
  316. package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
  317. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
  318. package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
  319. package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
  320. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
  321. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
  322. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
  323. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
  324. package/build-types/components/collab-sidebar/comments.d.ts +0 -10
  325. package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
  326. package/build-types/components/global-styles-provider/index.d.ts +0 -16
  327. package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
  328. package/build-types/components/media/index.d.ts +0 -3
  329. package/build-types/components/media/index.d.ts.map +0 -1
  330. package/build-types/components/media/metadata-panel.d.ts +0 -12
  331. package/build-types/components/media/metadata-panel.d.ts.map +0 -1
  332. package/build-types/components/media/preview.d.ts +0 -9
  333. package/build-types/components/media/preview.d.ts.map +0 -1
  334. package/build-types/components/post-revisions-panel/index.d.ts +0 -2
  335. package/build-types/components/post-revisions-panel/index.d.ts.map +0 -1
  336. package/build-types/components/revision-author-panel/index.d.ts +0 -2
  337. package/build-types/components/revision-author-panel/index.d.ts.map +0 -1
  338. package/build-types/components/revision-created-panel/index.d.ts +0 -2
  339. package/build-types/components/revision-created-panel/index.d.ts.map +0 -1
  340. package/src/components/editor-help/images/add-dark.png +0 -0
  341. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  342. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  343. package/src/components/editor-help/images/add-light.png +0 -0
  344. package/src/components/editor-help/images/add-light@2x.png +0 -0
  345. package/src/components/editor-help/images/add-light@3x.png +0 -0
  346. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  347. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  348. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  349. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  350. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  351. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  352. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  353. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  354. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  355. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  356. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  357. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  358. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  359. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  360. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  361. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  362. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  363. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  364. package/src/components/editor-help/images/edit-media-light.png +0 -0
  365. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  366. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  367. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  368. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  369. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  370. package/src/components/editor-help/images/embed-media-light.png +0 -0
  371. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  372. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  373. package/src/components/editor-help/images/move-dark.png +0 -0
  374. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  375. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  376. package/src/components/editor-help/images/move-light.png +0 -0
  377. package/src/components/editor-help/images/move-light@2x.png +0 -0
  378. package/src/components/editor-help/images/move-light@3x.png +0 -0
  379. package/src/components/editor-help/images/options-dark.png +0 -0
  380. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  381. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  382. package/src/components/editor-help/images/options-light.png +0 -0
  383. package/src/components/editor-help/images/options-light@2x.png +0 -0
  384. package/src/components/editor-help/images/options-light@3x.png +0 -0
  385. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  386. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  387. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  388. package/src/components/editor-help/images/rich-text-light.png +0 -0
  389. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  390. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  391. package/src/components/editor-help/images/settings-dark.png +0 -0
  392. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  393. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  394. package/src/components/editor-help/images/settings-light.png +0 -0
  395. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  396. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  397. package/src/components/editor-help/style.scss +0 -123
  398. package/src/components/post-revisions-panel/index.js +0 -161
  399. package/src/components/post-revisions-panel/style.scss +0 -16
  400. package/src/components/revision-author-panel/index.js +0 -36
  401. package/src/components/revision-created-panel/index.js +0 -36
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-revisions-preview/block-diff.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\n/*\n * `diffWordsWithSpace` preserves the v4-style per-word output. v6+\n * stopped treating whitespace as a token in `diffWords`, which coalesces\n * adjacent word changes into a single removed/added pair.\n */\nimport { diffArrays, diffWordsWithSpace } from 'diff';\n\n/**\n * WordPress dependencies\n */\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\nimport {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\tRichTextData,\n\tcreate,\n\tslice,\n\tconcat,\n\tapplyFormat,\n} from '@wordpress/rich-text';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { parseRawBlock } = unlock( blocksPrivateApis );\n\n/**\n * Whether a grammar-parsed raw block is a whitespace-only freeform pseudo-block\n * (the `\\n\\n` between block markers, etc). These are stripped from both arrays\n * before LCS to keep the matching pivot stable: under `diff` v6's tie-breaker,\n * a whitespace block could otherwise be selected as the LCS anchor in\n * `[paragraph, whitespace, paragraph]` swaps, mis-pairing the surrounding\n * paragraphs in `pairSimilarBlocks`. Whitespace pseudo-blocks don't render\n * anyway (`parseRawBlock` returns undefined for them), so dropping them\n * before the diff has no user-visible effect.\n *\n * @param {Object} rawBlock A raw block from `@wordpress/block-serialization-default-parser`.\n * @return {boolean} True if the block should be excluded from LCS matching.\n */\nfunction isWhitespaceRawBlock( rawBlock ) {\n\treturn (\n\t\trawBlock.blockName === null &&\n\t\t( ! rawBlock.innerHTML || ! rawBlock.innerHTML.trim() )\n\t);\n}\n\n/**\n * Safely stringifies a value for display and comparison.\n *\n * @param {*} value The value to stringify.\n * @return {string} The stringified value.\n */\nfunction stringifyValue( value ) {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\tif ( typeof value === 'object' ) {\n\t\treturn JSON.stringify( value, null, 2 );\n\t}\n\treturn String( value );\n}\n\n/**\n * Calculate text similarity using word-set overlap.\n *\n * Uses a variant of the Jaccard index (https://en.wikipedia.org/wiki/Jaccard_index)\n * called the overlap coefficient (https://en.wikipedia.org/wiki/Overlap_coefficient)\n * where we divide by the larger set size rather than the union. This ensures that\n * a small edit to a long paragraph scores high \u2014 the few changed words don't\n * dilute the score.\n *\n * This replaces the previous diffWords-based similarity which was O(n*m) per pair.\n * The word-set approach is O(n) where n is the number of words.\n *\n * Words are extracted using Intl.Segmenter for proper multilingual support\n * (CJK, Thai, etc.) rather than splitting on whitespace.\n *\n * @param {string} text1 First text to compare.\n * @param {string} text2 Second text to compare.\n * @return {number} Similarity score between 0 and 1.\n */\nfunction textSimilarity( text1, text2 ) {\n\tif ( ! text1 && ! text2 ) {\n\t\treturn 1;\n\t}\n\tif ( ! text1 || ! text2 ) {\n\t\treturn 0;\n\t}\n\n\tconst segmenter = new Intl.Segmenter( undefined, {\n\t\tgranularity: 'word',\n\t} );\n\t// Safari's Intl.Segmenter returns isWordLike: false for numeric segments,\n\t// so fall back to a Unicode-aware regex for letters and numbers.\n\tconst wordLikeRegex = /[\\p{L}\\p{N}]/u;\n\tconst getWords = ( text ) => {\n\t\tconst words = [];\n\t\tfor ( const { segment, isWordLike } of segmenter.segment( text ) ) {\n\t\t\tif ( isWordLike || wordLikeRegex.test( segment ) ) {\n\t\t\t\twords.push( segment );\n\t\t\t}\n\t\t}\n\t\treturn words;\n\t};\n\tconst words1 = getWords( text1 );\n\tconst words2 = getWords( text2 );\n\n\tif ( words1.length === 0 && words2.length === 0 ) {\n\t\treturn 1;\n\t}\n\n\tconst set1 = new Set( words1 );\n\tlet intersection = 0;\n\tfor ( const word of words2 ) {\n\t\tif ( set1.has( word ) ) {\n\t\t\tintersection++;\n\t\t}\n\t}\n\n\tconst total = Math.max( words1.length, words2.length );\n\treturn total > 0 ? intersection / total : 0;\n}\n\n/**\n * Post-process diff result to pair similar removed/added blocks as modifications.\n *\n * After LCS diffing, a block whose content changed appears as a separate \"removed\"\n * and \"added\" entry (since the full block signature differs). This function detects\n * such pairs and merges them into a single \"modified\" block with inline diff.\n *\n * Two pairing strategies are used:\n * 1. When exactly one block of a given type was removed and one was added,\n * they are paired directly \u2014 no ambiguity, no similarity check needed.\n * 2. When multiple candidates exist, textSimilarity (overlap coefficient) is\n * used to find the best match. Blocks must share at least 50% of their\n * words to be paired, preventing unrelated paragraphs from being merged.\n *\n * @param {Array} blocks Raw blocks with diff status.\n * @return {Array} Blocks with similar pairs converted to modifications.\n */\nfunction pairSimilarBlocks( blocks ) {\n\tconst removed = [];\n\tconst added = [];\n\n\t// Separate blocks by status, tracking original indices.\n\tblocks.forEach( ( block, index ) => {\n\t\tconst status = block.__revisionDiffStatus?.status;\n\t\tif ( status === 'removed' ) {\n\t\t\tremoved.push( { block, index } );\n\t\t} else if ( status === 'added' ) {\n\t\t\tadded.push( { block, index } );\n\t\t}\n\t} );\n\n\t// If no removed or no added, nothing to pair.\n\tif ( removed.length === 0 || added.length === 0 ) {\n\t\treturn blocks;\n\t}\n\n\tconst pairedRemoved = new Set(); // Indices of removed blocks filtered out.\n\tconst pairedAdded = new Set(); // Indices of added blocks filtered out.\n\tconst modifications = new Map(); // Index \u2192 modified block.\n\tconst SIMILARITY_THRESHOLD = 0.5;\n\n\t// Group candidates by block name for efficient lookup.\n\tconst addedByName = new Map();\n\tfor ( const add of added ) {\n\t\tconst name = add.block.blockName;\n\t\tif ( ! addedByName.has( name ) ) {\n\t\t\taddedByName.set( name, [] );\n\t\t}\n\t\taddedByName.get( name ).push( add );\n\t}\n\tconst removedByName = new Map();\n\tfor ( const rem of removed ) {\n\t\tconst name = rem.block.blockName;\n\t\tif ( ! removedByName.has( name ) ) {\n\t\t\tremovedByName.set( name, [] );\n\t\t}\n\t\tremovedByName.get( name ).push( rem );\n\t}\n\n\t// For each removed block, find best matching added block.\n\t// Track the highest added index paired so far \u2014 new pairings must\n\t// not go backwards, or the removed/added text order would break.\n\tlet maxPairedAddedIndex = -1;\n\n\tfor ( const rem of removed ) {\n\t\tconst candidates = addedByName.get( rem.block.blockName ) || [];\n\t\tconst sameNameRemoved = removedByName.get( rem.block.blockName ) || [];\n\t\tconst unpaired = candidates.filter(\n\t\t\t( add ) =>\n\t\t\t\t! modifications.has( add.index ) &&\n\t\t\t\tadd.index > maxPairedAddedIndex\n\t\t);\n\n\t\tif ( unpaired.length === 0 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet bestMatch = null;\n\n\t\t// If there's exactly one removed and one added of this type,\n\t\t// pair them directly \u2014 no ambiguity, no similarity check needed.\n\t\tif ( sameNameRemoved.length === 1 && unpaired.length === 1 ) {\n\t\t\tconst add = unpaired[ 0 ];\n\t\t\tconst attrsMatch =\n\t\t\t\tJSON.stringify( rem.block.attrs ) ===\n\t\t\t\tJSON.stringify( add.block.attrs );\n\t\t\t// Only skip pairing if both content and attrs are identical\n\t\t\t// (position swap, not a modification).\n\t\t\tconst contentMatch =\n\t\t\t\t( rem.block.innerHTML || '' ) === ( add.block.innerHTML || '' );\n\t\t\tif ( ! contentMatch || ! attrsMatch ) {\n\t\t\t\tbestMatch = add;\n\t\t\t}\n\t\t} else {\n\t\t\t// Multiple candidates \u2014 use similarity to find best match.\n\t\t\tlet bestScore = 0;\n\t\t\tfor ( const add of unpaired ) {\n\t\t\t\tconst score = textSimilarity(\n\t\t\t\t\trem.block.innerHTML || '',\n\t\t\t\t\tadd.block.innerHTML || ''\n\t\t\t\t);\n\t\t\t\t// Skip identical blocks (score=1 with same attrs) \u2014 those\n\t\t\t\t// are position swaps, not modifications. They should show\n\t\t\t\t// as separate removed + added, not as a no-op \"modified\".\n\t\t\t\tconst attrsMatch =\n\t\t\t\t\tJSON.stringify( rem.block.attrs ) ===\n\t\t\t\t\tJSON.stringify( add.block.attrs );\n\t\t\t\tif (\n\t\t\t\t\tscore > bestScore &&\n\t\t\t\t\tscore > SIMILARITY_THRESHOLD &&\n\t\t\t\t\t( score < 1 || ! attrsMatch )\n\t\t\t\t) {\n\t\t\t\t\tbestScore = score;\n\t\t\t\t\tbestMatch = add;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( bestMatch ) {\n\t\t\tmaxPairedAddedIndex = bestMatch.index;\n\n\t\t\tconst modifiedBlock = {\n\t\t\t\t...bestMatch.block,\n\t\t\t\t__revisionDiffStatus: { status: 'modified' },\n\t\t\t\t__previousRawBlock: rem.block,\n\t\t\t};\n\n\t\t\t// Decide where to place the modified block by checking\n\t\t\t// what's between the removed and added positions. If any\n\t\t\t// block between them is in the current revision (an\n\t\t\t// unchanged block, or an unpaired added block), placing\n\t\t\t// the modification at the removed position would put it\n\t\t\t// before content that already comes before it in the\n\t\t\t// current revision \u2014 so use the added position instead.\n\t\t\t// Otherwise, use the removed position to keep the previous\n\t\t\t// revision's reading order intact.\n\t\t\t//\n\t\t\t// 'removed' blocks (and added blocks already absorbed via\n\t\t\t// `pairedAdded`) aren't checked because they aren't in the\n\t\t\t// current revision and so don't count as crossing it.\n\t\t\tconst lo = Math.min( rem.index, bestMatch.index );\n\t\t\tconst hi = Math.max( rem.index, bestMatch.index );\n\t\t\tlet crossesCurrentContent = false;\n\t\t\tfor ( let i = lo + 1; i < hi; i++ ) {\n\t\t\t\tconst status = blocks[ i ].__revisionDiffStatus?.status;\n\t\t\t\tif ( status === undefined ) {\n\t\t\t\t\tcrossesCurrentContent = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( status === 'added' && ! pairedAdded.has( i ) ) {\n\t\t\t\t\tcrossesCurrentContent = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( crossesCurrentContent ) {\n\t\t\t\t// Use the added position \u2014 don't jump before\n\t\t\t\t// current-revision content.\n\t\t\t\tmodifications.set( bestMatch.index, modifiedBlock );\n\t\t\t\tpairedRemoved.add( rem.index );\n\t\t\t} else {\n\t\t\t\t// Use the removed position \u2014 keep the previous\n\t\t\t\t// revision's reading order.\n\t\t\t\tmodifications.set( rem.index, modifiedBlock );\n\t\t\t\tpairedAdded.add( bestMatch.index );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Rebuild result: replace modification targets, filter out\n\t// their paired counterparts.\n\treturn blocks\n\t\t.map( ( block, index ) => {\n\t\t\tif ( pairedRemoved.has( index ) || pairedAdded.has( index ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( modifications.has( index ) ) {\n\t\t\t\treturn modifications.get( index );\n\t\t\t}\n\t\t\treturn block;\n\t\t} )\n\t\t.filter( Boolean );\n}\n\n/**\n * Diff raw block arrays using LCS, recursively handling innerBlocks.\n * Detects modifications when exactly 1 block is removed and 1 is added\n * with the same blockName (1:1 replacement = modification).\n *\n * Whitespace-only freeform pseudo-blocks are filtered at every recursive\n * level so this function is safe to call directly with raw output from\n * `@wordpress/block-serialization-default-parser`. The duplicate work for\n * inner-block recursion is negligible and keeps the contract self-contained.\n *\n * @param {Array} currentRaw Current revision's raw blocks.\n * @param {Array} previousRaw Previous revision's raw blocks.\n * @return {Array} Merged raw blocks with diff status injected.\n */\nfunction diffRawBlocks( currentRaw, previousRaw ) {\n\t// Strip whitespace-only freeform pseudo-blocks before LCS \u2014 see\n\t// `isWhitespaceRawBlock` for why.\n\tcurrentRaw = currentRaw.filter( ( b ) => ! isWhitespaceRawBlock( b ) );\n\tpreviousRaw = previousRaw.filter( ( b ) => ! isWhitespaceRawBlock( b ) );\n\n\tconst createBlockSignature = ( rawBlock ) =>\n\t\tJSON.stringify( {\n\t\t\tname: rawBlock.blockName,\n\t\t\tattrs: rawBlock.attrs,\n\t\t\t// Use innerContent filtered to non-null and non-whitespace-only strings.\n\t\t\t// This excludes whitespace between inner blocks which changes based on count.\n\t\t\thtml: ( rawBlock.innerContent || [] ).filter(\n\t\t\t\t( c ) => c !== null && c.trim() !== ''\n\t\t\t),\n\t\t} );\n\tconst currentSigs = currentRaw.map( createBlockSignature );\n\tconst previousSigs = previousRaw.map( createBlockSignature );\n\n\tconst diff = diffArrays( previousSigs, currentSigs );\n\n\tconst result = [];\n\tlet currIdx = 0;\n\tlet prevIdx = 0;\n\n\tfor ( const part of diff ) {\n\t\tif ( part.added ) {\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\t...currentRaw[ currIdx++ ],\n\t\t\t\t\t__revisionDiffStatus: { status: 'added' },\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if ( part.removed ) {\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\t...previousRaw[ prevIdx++ ],\n\t\t\t\t\t__revisionDiffStatus: { status: 'removed' },\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Matched blocks - recursively diff their innerBlocks.\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tconst currBlock = currentRaw[ currIdx++ ];\n\t\t\t\tconst prevBlock = previousRaw[ prevIdx++ ];\n\n\t\t\t\t// Recursively diff inner blocks.\n\t\t\t\tconst diffedInnerBlocks = diffRawBlocks(\n\t\t\t\t\tcurrBlock.innerBlocks || [],\n\t\t\t\t\tprevBlock.innerBlocks || []\n\t\t\t\t);\n\n\t\t\t\tresult.push( {\n\t\t\t\t\t...currBlock,\n\t\t\t\t\tinnerBlocks: diffedInnerBlocks,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Post-process to pair similar removed/added blocks as modifications.\n\treturn pairSimilarBlocks( result );\n}\n\n/**\n * Check if formatting has changed at specific character indices.\n *\n * @param {Array} currentFormats Current formats array.\n * @param {Array} previousFormats Previous formats array.\n * @param {number} currentIndex Character index in current.\n * @param {number} previousIndex Character index in previous.\n * @return {boolean} True if formatting changed at these indices.\n */\nfunction hasFormatChangedAtIndex(\n\tcurrentFormats,\n\tpreviousFormats,\n\tcurrentIndex,\n\tpreviousIndex\n) {\n\tconst currFmts = currentFormats[ currentIndex ] || [];\n\tconst prevFmts = previousFormats[ previousIndex ] || [];\n\n\tif ( currFmts.length !== prevFmts.length ) {\n\t\treturn true;\n\t}\n\n\t// Check if each format in current exists in previous\n\tfor ( const fmt of currFmts ) {\n\t\tconst match = prevFmts.find(\n\t\t\t( pf ) =>\n\t\t\t\tpf.type === fmt.type &&\n\t\t\t\tJSON.stringify( pf.attributes ) ===\n\t\t\t\t\tJSON.stringify( fmt.attributes )\n\t\t);\n\t\tif ( ! match ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Analyze what formatting changed between two character positions.\n * Returns both the change type (for styling) and a description (for tooltip).\n *\n * @param {Array} currentFormats Current formats array.\n * @param {Array} previousFormats Previous formats array.\n * @param {number} currIdx Character index in current.\n * @param {number} prevIdx Character index in previous.\n * @return {{ type: 'added'|'removed'|'changed', description: string }} Change info.\n */\nfunction describeFormatChange(\n\tcurrentFormats,\n\tpreviousFormats,\n\tcurrIdx,\n\tprevIdx\n) {\n\tconst currFmts = currentFormats[ currIdx ] || [];\n\tconst prevFmts = previousFormats[ prevIdx ] || [];\n\n\tlet addedCount = 0;\n\tlet removedCount = 0;\n\tlet changedCount = 0;\n\n\t// Find added formats and attribute changes\n\tfor ( const fmt of currFmts ) {\n\t\tconst match = prevFmts.find( ( pf ) => pf.type === fmt.type );\n\t\tif ( ! match ) {\n\t\t\taddedCount++;\n\t\t} else if (\n\t\t\tJSON.stringify( fmt.attributes ) !==\n\t\t\tJSON.stringify( match.attributes )\n\t\t) {\n\t\t\tchangedCount++;\n\t\t}\n\t}\n\n\t// Find removed formats\n\tfor ( const fmt of prevFmts ) {\n\t\tconst match = currFmts.find( ( cf ) => cf.type === fmt.type );\n\t\tif ( ! match ) {\n\t\t\tremovedCount++;\n\t\t}\n\t}\n\n\t// Determine primary change type for styling\n\tif ( addedCount > 0 && removedCount === 0 && changedCount === 0 ) {\n\t\treturn {\n\t\t\ttype: 'added',\n\t\t\tdescription: sprintf(\n\t\t\t\t/* translators: %d: number of formats added */\n\t\t\t\t_n( '%d format added', '%d formats added', addedCount ),\n\t\t\t\taddedCount\n\t\t\t),\n\t\t};\n\t}\n\tif ( removedCount > 0 && addedCount === 0 && changedCount === 0 ) {\n\t\treturn {\n\t\t\ttype: 'removed',\n\t\t\tdescription: sprintf(\n\t\t\t\t/* translators: %d: number of formats removed */\n\t\t\t\t_n( '%d format removed', '%d formats removed', removedCount ),\n\t\t\t\tremovedCount\n\t\t\t),\n\t\t};\n\t}\n\n\t// Mixed or attribute-only changes\n\tconst parts = [];\n\tif ( addedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats added */\n\t\t\t\t_n( '%d format added', '%d formats added', addedCount ),\n\t\t\t\taddedCount\n\t\t\t)\n\t\t);\n\t}\n\tif ( removedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats removed */\n\t\t\t\t_n( '%d format removed', '%d formats removed', removedCount ),\n\t\t\t\tremovedCount\n\t\t\t)\n\t\t);\n\t}\n\tif ( changedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats changed */\n\t\t\t\t_n( '%d format changed', '%d formats changed', changedCount ),\n\t\t\t\tchangedCount\n\t\t\t)\n\t\t);\n\t}\n\treturn {\n\t\ttype: 'changed',\n\t\tdescription: parts.join( ', ' ) || __( 'Formatting changed' ),\n\t};\n}\n\n/**\n * Apply inline diff formatting comparing two RichTextData values.\n * - Text changes: apply revision/diff-removed and revision/diff-added formats\n * - Format-only changes (text unchanged): apply revision/diff-format-changed format\n *\n * @param {RichTextData} currentRichText Current revision's rich text.\n * @param {RichTextData} previousRichText Previous revision's rich text.\n * @return {RichTextData} New rich text with diff formatting applied.\n */\nfunction applyRichTextDiff( currentRichText, previousRichText ) {\n\tconst currentText = currentRichText.toPlainText();\n\tconst previousText = previousRichText.toPlainText();\n\n\t// Diff the plain text (words for cleaner output).\n\tconst textDiff = diffWordsWithSpace( previousText, currentText );\n\n\tlet result = create( { text: '' } );\n\tlet currentIdx = 0;\n\tlet previousIdx = 0;\n\n\tfor ( const part of textDiff ) {\n\t\tif ( part.removed ) {\n\t\t\t// Text deleted - slice from PREVIOUS, apply <del>\n\t\t\tconst removedSlice = slice(\n\t\t\t\tpreviousRichText,\n\t\t\t\tpreviousIdx,\n\t\t\t\tpreviousIdx + part.value.length\n\t\t\t);\n\t\t\tconst formatted = applyFormat(\n\t\t\t\tremovedSlice,\n\t\t\t\t{\n\t\t\t\t\ttype: 'revision/diff-removed',\n\t\t\t\t\tattributes: { title: __( 'Removed' ) },\n\t\t\t\t},\n\t\t\t\t0,\n\t\t\t\tpart.value.length\n\t\t\t);\n\t\t\tresult = concat( result, formatted );\n\t\t\tpreviousIdx += part.value.length;\n\t\t} else if ( part.added ) {\n\t\t\t// Text added - slice from CURRENT, apply <ins>\n\t\t\tconst addedSlice = slice(\n\t\t\t\tcurrentRichText,\n\t\t\t\tcurrentIdx,\n\t\t\t\tcurrentIdx + part.value.length\n\t\t\t);\n\t\t\tconst formatted = applyFormat(\n\t\t\t\taddedSlice,\n\t\t\t\t{\n\t\t\t\t\ttype: 'revision/diff-added',\n\t\t\t\t\tattributes: { title: __( 'Added' ) },\n\t\t\t\t},\n\t\t\t\t0,\n\t\t\t\tpart.value.length\n\t\t\t);\n\t\t\tresult = concat( result, formatted );\n\t\t\tcurrentIdx += part.value.length;\n\t\t} else {\n\t\t\t// Text unchanged - check formatting at each character position.\n\t\t\t// Only apply <mark> to specific ranges where formatting differs.\n\t\t\tconst currentFormats = currentRichText.formats || [];\n\t\t\tconst previousFormats = previousRichText.formats || [];\n\t\t\tconst len = part.value.length;\n\n\t\t\t// Helper to check format change at offset within this unchanged part.\n\t\t\tconst checkFormatChanged = ( offset ) =>\n\t\t\t\thasFormatChangedAtIndex(\n\t\t\t\t\tcurrentFormats,\n\t\t\t\t\tpreviousFormats,\n\t\t\t\t\tcurrentIdx + offset,\n\t\t\t\t\tpreviousIdx + offset\n\t\t\t\t);\n\n\t\t\t// Find ranges of characters grouped by whether format changed.\n\t\t\tlet rangeStart = 0;\n\t\t\tlet rangeFormatChanged = checkFormatChanged( 0 );\n\n\t\t\tfor ( let i = 1; i <= len; i++ ) {\n\t\t\t\tconst formatChanged = i < len && checkFormatChanged( i );\n\n\t\t\t\t// When format-changed status changes or we reach the end, emit range.\n\t\t\t\tif ( i === len || formatChanged !== rangeFormatChanged ) {\n\t\t\t\t\tconst rangeSlice = slice(\n\t\t\t\t\t\tcurrentRichText,\n\t\t\t\t\t\tcurrentIdx + rangeStart,\n\t\t\t\t\t\tcurrentIdx + i\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( rangeFormatChanged ) {\n\t\t\t\t\t\t// Get type and description of what changed\n\t\t\t\t\t\tconst { type, description } = describeFormatChange(\n\t\t\t\t\t\t\tcurrentFormats,\n\t\t\t\t\t\t\tpreviousFormats,\n\t\t\t\t\t\t\tcurrentIdx + rangeStart,\n\t\t\t\t\t\t\tpreviousIdx + rangeStart\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Map change type to format type for styling\n\t\t\t\t\t\tconst formatType = {\n\t\t\t\t\t\t\tadded: 'revision/diff-format-added',\n\t\t\t\t\t\t\tremoved: 'revision/diff-format-removed',\n\t\t\t\t\t\t\tchanged: 'revision/diff-format-changed',\n\t\t\t\t\t\t}[ type ];\n\n\t\t\t\t\t\tconst marked = applyFormat(\n\t\t\t\t\t\t\trangeSlice,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: formatType,\n\t\t\t\t\t\t\t\tattributes: { title: description },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\ti - rangeStart\n\t\t\t\t\t\t);\n\t\t\t\t\t\tresult = concat( result, marked );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = concat( result, rangeSlice );\n\t\t\t\t\t}\n\n\t\t\t\t\trangeStart = i;\n\t\t\t\t\trangeFormatChanged = formatChanged;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurrentIdx += part.value.length;\n\t\t\tpreviousIdx += part.value.length;\n\t\t}\n\t}\n\n\treturn new RichTextData( result );\n}\n\n/**\n * Apply diffs to a modified block's attributes.\n * - Rich-text attributes: applies inline diff formatting (ins/del marks).\n * - Other attributes: computes word-level diffs for the sidebar panel.\n *\n * @param {Object} currentBlock Current parsed block.\n * @param {Object} previousBlock Previous parsed block.\n * @param {Object} diffStatus The __revisionDiffStatus object to attach changedAttributes to.\n */\nfunction applyDiffToBlock( currentBlock, previousBlock, diffStatus ) {\n\tconst blockType = getBlockType( currentBlock.name );\n\tif ( ! blockType ) {\n\t\treturn;\n\t}\n\n\tconst changedAttributes = {};\n\n\tfor ( const [ attrName, attrDef ] of Object.entries(\n\t\tblockType.attributes\n\t) ) {\n\t\tif ( attrDef.source === 'rich-text' ) {\n\t\t\tconst currentRichText = currentBlock.attributes[ attrName ];\n\t\t\tconst previousRichText = previousBlock.attributes[ attrName ];\n\t\t\tif (\n\t\t\t\tcurrentRichText instanceof RichTextData &&\n\t\t\t\tpreviousRichText instanceof RichTextData\n\t\t\t) {\n\t\t\t\tcurrentBlock.attributes[ attrName ] = applyRichTextDiff(\n\t\t\t\t\tcurrentRichText,\n\t\t\t\t\tpreviousRichText\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst currStr = stringifyValue(\n\t\t\t\tcurrentBlock.attributes[ attrName ]\n\t\t\t);\n\t\t\tconst prevStr = stringifyValue(\n\t\t\t\tpreviousBlock.attributes[ attrName ]\n\t\t\t);\n\t\t\tif ( currStr !== prevStr ) {\n\t\t\t\tchangedAttributes[ attrName ] = diffWordsWithSpace(\n\t\t\t\t\tprevStr,\n\t\t\t\t\tcurrStr\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( Object.keys( changedAttributes ).length > 0 ) {\n\t\tdiffStatus.changedAttributes = changedAttributes;\n\t}\n}\n\n/**\n * Recursively apply diff status and rich text diff to blocks in the tree.\n * Copies __revisionDiffStatus from raw blocks to parsed blocks and applies\n * rich text diffs to modified blocks.\n *\n * @param {Object} parsedBlock Parsed block (with inner blocks).\n * @param {Object} rawBlock Raw block (with __revisionDiffStatus and __previousRawBlock).\n */\nfunction applyDiffRecursively( parsedBlock, rawBlock ) {\n\t// Copy diff status from raw block to parsed block.\n\tif ( rawBlock.__revisionDiffStatus ) {\n\t\t// Apply diffs if this block is modified and has a previous raw block.\n\t\tif (\n\t\t\trawBlock.__revisionDiffStatus.status === 'modified' &&\n\t\t\trawBlock.__previousRawBlock\n\t\t) {\n\t\t\tconst previousParsed = parseRawBlock( rawBlock.__previousRawBlock );\n\t\t\tif ( previousParsed ) {\n\t\t\t\tapplyDiffToBlock(\n\t\t\t\t\tparsedBlock,\n\t\t\t\t\tpreviousParsed,\n\t\t\t\t\trawBlock.__revisionDiffStatus\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tparsedBlock.__revisionDiffStatus = rawBlock.__revisionDiffStatus;\n\t\t// Also store in attributes so it survives block-editor store normalization.\n\t\tparsedBlock.attributes.__revisionDiffStatus =\n\t\t\trawBlock.__revisionDiffStatus;\n\t}\n\n\t// Recursively process inner blocks.\n\tif ( parsedBlock.innerBlocks && rawBlock.innerBlocks ) {\n\t\tfor ( let i = 0; i < parsedBlock.innerBlocks.length; i++ ) {\n\t\t\tconst parsedInner = parsedBlock.innerBlocks[ i ];\n\t\t\tconst rawInner = rawBlock.innerBlocks[ i ];\n\t\t\tif ( parsedInner && rawInner ) {\n\t\t\t\tapplyDiffRecursively( parsedInner, rawInner );\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Diff two revision contents at the grammar level.\n *\n * @param {string} currentContent Current revision's raw content.\n * @param {string} previousContent Previous revision's raw content.\n * @return {Array} Array of parsed blocks with diff status attributes.\n */\nexport function diffRevisionContent( currentContent, previousContent ) {\n\t// Grammar parse both contents.\n\tconst currentRaw = grammarParse( currentContent || '' );\n\tconst previousRaw = grammarParse( previousContent || '' );\n\n\t// Diff the raw block arrays.\n\tconst mergedRaw = diffRawBlocks( currentRaw, previousRaw );\n\n\t// Parse each raw block and apply diff status.\n\treturn mergedRaw\n\t\t.map( ( rawBlock ) => {\n\t\t\tconst parsed = parseRawBlock( rawBlock );\n\t\t\tif ( parsed ) {\n\t\t\t\tapplyDiffRecursively( parsed, rawBlock );\n\t\t\t}\n\t\t\treturn parsed;\n\t\t} )\n\t\t.filter( Boolean );\n}\n"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\n/*\n * `diffWordsWithSpace` preserves the v4-style per-word output. v6+\n * stopped treating whitespace as a token in `diffWords`, which coalesces\n * adjacent word changes into a single removed/added pair.\n */\nimport { diffArrays, diffWordsWithSpace } from 'diff';\n\n/**\n * WordPress dependencies\n */\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\nimport {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\tRichTextData,\n\tcreate,\n\tslice,\n\tconcat,\n\tapplyFormat,\n} from '@wordpress/rich-text';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { parseRawBlock } = unlock( blocksPrivateApis );\n\n/**\n * Whether a grammar-parsed raw block is a whitespace-only freeform pseudo-block\n * (the `\\n\\n` between block markers, etc). These are stripped from both arrays\n * before LCS to keep the matching pivot stable: under `diff` v6's tie-breaker,\n * a whitespace block could otherwise be selected as the LCS anchor in\n * `[paragraph, whitespace, paragraph]` swaps, mis-pairing the surrounding\n * paragraphs in `pairSimilarBlocks`. Whitespace pseudo-blocks don't render\n * anyway (`parseRawBlock` returns undefined for them), so dropping them\n * before the diff has no user-visible effect.\n *\n * @param {Object} rawBlock A raw block from `@wordpress/block-serialization-default-parser`.\n * @return {boolean} True if the block should be excluded from LCS matching.\n */\nfunction isWhitespaceRawBlock( rawBlock ) {\n\treturn (\n\t\trawBlock.blockName === null &&\n\t\t( ! rawBlock.innerHTML || ! rawBlock.innerHTML.trim() )\n\t);\n}\n\n/**\n * Safely stringifies a value for display and comparison.\n *\n * @param {*} value The value to stringify.\n * @return {string} The stringified value.\n */\nfunction stringifyValue( value ) {\n\tif ( value === null || value === undefined ) {\n\t\treturn '';\n\t}\n\tif ( typeof value === 'object' ) {\n\t\treturn JSON.stringify( value, null, 2 );\n\t}\n\treturn String( value );\n}\n\n/**\n * Calculate text similarity using word-set overlap.\n *\n * Uses a variant of the Jaccard index (https://en.wikipedia.org/wiki/Jaccard_index)\n * called the overlap coefficient (https://en.wikipedia.org/wiki/Overlap_coefficient)\n * where we divide by the larger set size rather than the union. This ensures that\n * a small edit to a long paragraph scores high — the few changed words don't\n * dilute the score.\n *\n * This replaces the previous diffWords-based similarity which was O(n*m) per pair.\n * The word-set approach is O(n) where n is the number of words.\n *\n * Words are extracted using Intl.Segmenter for proper multilingual support\n * (CJK, Thai, etc.) rather than splitting on whitespace.\n *\n * @param {string} text1 First text to compare.\n * @param {string} text2 Second text to compare.\n * @return {number} Similarity score between 0 and 1.\n */\nfunction textSimilarity( text1, text2 ) {\n\tif ( ! text1 && ! text2 ) {\n\t\treturn 1;\n\t}\n\tif ( ! text1 || ! text2 ) {\n\t\treturn 0;\n\t}\n\n\tconst segmenter = new Intl.Segmenter( undefined, {\n\t\tgranularity: 'word',\n\t} );\n\t// Safari's Intl.Segmenter returns isWordLike: false for numeric segments,\n\t// so fall back to a Unicode-aware regex for letters and numbers.\n\tconst wordLikeRegex = /[\\p{L}\\p{N}]/u;\n\tconst getWords = ( text ) => {\n\t\tconst words = [];\n\t\tfor ( const { segment, isWordLike } of segmenter.segment( text ) ) {\n\t\t\tif ( isWordLike || wordLikeRegex.test( segment ) ) {\n\t\t\t\twords.push( segment );\n\t\t\t}\n\t\t}\n\t\treturn words;\n\t};\n\tconst words1 = getWords( text1 );\n\tconst words2 = getWords( text2 );\n\n\tif ( words1.length === 0 && words2.length === 0 ) {\n\t\treturn 1;\n\t}\n\n\tconst set1 = new Set( words1 );\n\tlet intersection = 0;\n\tfor ( const word of words2 ) {\n\t\tif ( set1.has( word ) ) {\n\t\t\tintersection++;\n\t\t}\n\t}\n\n\tconst total = Math.max( words1.length, words2.length );\n\treturn total > 0 ? intersection / total : 0;\n}\n\n/**\n * Post-process diff result to pair similar removed/added blocks as modifications.\n *\n * After LCS diffing, a block whose content changed appears as a separate \"removed\"\n * and \"added\" entry (since the full block signature differs). This function detects\n * such pairs and merges them into a single \"modified\" block with inline diff.\n *\n * Two pairing strategies are used:\n * 1. When exactly one block of a given type was removed and one was added,\n * they are paired directly — no ambiguity, no similarity check needed.\n * 2. When multiple candidates exist, textSimilarity (overlap coefficient) is\n * used to find the best match. Blocks must share at least 50% of their\n * words to be paired, preventing unrelated paragraphs from being merged.\n *\n * @param {Array} blocks Raw blocks with diff status.\n * @return {Array} Blocks with similar pairs converted to modifications.\n */\nfunction pairSimilarBlocks( blocks ) {\n\tconst removed = [];\n\tconst added = [];\n\n\t// Separate blocks by status, tracking original indices.\n\tblocks.forEach( ( block, index ) => {\n\t\tconst status = block.__revisionDiffStatus?.status;\n\t\tif ( status === 'removed' ) {\n\t\t\tremoved.push( { block, index } );\n\t\t} else if ( status === 'added' ) {\n\t\t\tadded.push( { block, index } );\n\t\t}\n\t} );\n\n\t// If no removed or no added, nothing to pair.\n\tif ( removed.length === 0 || added.length === 0 ) {\n\t\treturn blocks;\n\t}\n\n\tconst pairedRemoved = new Set(); // Indices of removed blocks filtered out.\n\tconst pairedAdded = new Set(); // Indices of added blocks filtered out.\n\tconst modifications = new Map(); // Index → modified block.\n\tconst SIMILARITY_THRESHOLD = 0.5;\n\n\t// Group candidates by block name for efficient lookup.\n\tconst addedByName = new Map();\n\tfor ( const add of added ) {\n\t\tconst name = add.block.blockName;\n\t\tif ( ! addedByName.has( name ) ) {\n\t\t\taddedByName.set( name, [] );\n\t\t}\n\t\taddedByName.get( name ).push( add );\n\t}\n\tconst removedByName = new Map();\n\tfor ( const rem of removed ) {\n\t\tconst name = rem.block.blockName;\n\t\tif ( ! removedByName.has( name ) ) {\n\t\t\tremovedByName.set( name, [] );\n\t\t}\n\t\tremovedByName.get( name ).push( rem );\n\t}\n\n\t// For each removed block, find best matching added block.\n\t// Track the highest added index paired so far — new pairings must\n\t// not go backwards, or the removed/added text order would break.\n\tlet maxPairedAddedIndex = -1;\n\n\tfor ( const rem of removed ) {\n\t\tconst candidates = addedByName.get( rem.block.blockName ) || [];\n\t\tconst sameNameRemoved = removedByName.get( rem.block.blockName ) || [];\n\t\tconst unpaired = candidates.filter(\n\t\t\t( add ) =>\n\t\t\t\t! modifications.has( add.index ) &&\n\t\t\t\tadd.index > maxPairedAddedIndex\n\t\t);\n\n\t\tif ( unpaired.length === 0 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet bestMatch = null;\n\n\t\t// If there's exactly one removed and one added of this type,\n\t\t// pair them directly — no ambiguity, no similarity check needed.\n\t\tif ( sameNameRemoved.length === 1 && unpaired.length === 1 ) {\n\t\t\tconst add = unpaired[ 0 ];\n\t\t\tconst attrsMatch =\n\t\t\t\tJSON.stringify( rem.block.attrs ) ===\n\t\t\t\tJSON.stringify( add.block.attrs );\n\t\t\t// Only skip pairing if both content and attrs are identical\n\t\t\t// (position swap, not a modification).\n\t\t\tconst contentMatch =\n\t\t\t\t( rem.block.innerHTML || '' ) === ( add.block.innerHTML || '' );\n\t\t\tif ( ! contentMatch || ! attrsMatch ) {\n\t\t\t\tbestMatch = add;\n\t\t\t}\n\t\t} else {\n\t\t\t// Multiple candidates — use similarity to find best match.\n\t\t\tlet bestScore = 0;\n\t\t\tfor ( const add of unpaired ) {\n\t\t\t\tconst score = textSimilarity(\n\t\t\t\t\trem.block.innerHTML || '',\n\t\t\t\t\tadd.block.innerHTML || ''\n\t\t\t\t);\n\t\t\t\t// Skip identical blocks (score=1 with same attrs) — those\n\t\t\t\t// are position swaps, not modifications. They should show\n\t\t\t\t// as separate removed + added, not as a no-op \"modified\".\n\t\t\t\tconst attrsMatch =\n\t\t\t\t\tJSON.stringify( rem.block.attrs ) ===\n\t\t\t\t\tJSON.stringify( add.block.attrs );\n\t\t\t\tif (\n\t\t\t\t\tscore > bestScore &&\n\t\t\t\t\tscore > SIMILARITY_THRESHOLD &&\n\t\t\t\t\t( score < 1 || ! attrsMatch )\n\t\t\t\t) {\n\t\t\t\t\tbestScore = score;\n\t\t\t\t\tbestMatch = add;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( bestMatch ) {\n\t\t\tmaxPairedAddedIndex = bestMatch.index;\n\n\t\t\tconst modifiedBlock = {\n\t\t\t\t...bestMatch.block,\n\t\t\t\t__revisionDiffStatus: { status: 'modified' },\n\t\t\t\t__previousRawBlock: rem.block,\n\t\t\t};\n\n\t\t\t// Decide where to place the modified block by checking\n\t\t\t// what's between the removed and added positions. If any\n\t\t\t// block between them is in the current revision (an\n\t\t\t// unchanged block, or an unpaired added block), placing\n\t\t\t// the modification at the removed position would put it\n\t\t\t// before content that already comes before it in the\n\t\t\t// current revision — so use the added position instead.\n\t\t\t// Otherwise, use the removed position to keep the previous\n\t\t\t// revision's reading order intact.\n\t\t\t//\n\t\t\t// 'removed' blocks (and added blocks already absorbed via\n\t\t\t// `pairedAdded`) aren't checked because they aren't in the\n\t\t\t// current revision and so don't count as crossing it.\n\t\t\tconst lo = Math.min( rem.index, bestMatch.index );\n\t\t\tconst hi = Math.max( rem.index, bestMatch.index );\n\t\t\tlet crossesCurrentContent = false;\n\t\t\tfor ( let i = lo + 1; i < hi; i++ ) {\n\t\t\t\tconst status = blocks[ i ].__revisionDiffStatus?.status;\n\t\t\t\tif ( status === undefined ) {\n\t\t\t\t\tcrossesCurrentContent = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( status === 'added' && ! pairedAdded.has( i ) ) {\n\t\t\t\t\tcrossesCurrentContent = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( crossesCurrentContent ) {\n\t\t\t\t// Use the added position — don't jump before\n\t\t\t\t// current-revision content.\n\t\t\t\tmodifications.set( bestMatch.index, modifiedBlock );\n\t\t\t\tpairedRemoved.add( rem.index );\n\t\t\t} else {\n\t\t\t\t// Use the removed position — keep the previous\n\t\t\t\t// revision's reading order.\n\t\t\t\tmodifications.set( rem.index, modifiedBlock );\n\t\t\t\tpairedAdded.add( bestMatch.index );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Rebuild result: replace modification targets, filter out\n\t// their paired counterparts.\n\treturn blocks\n\t\t.map( ( block, index ) => {\n\t\t\tif ( pairedRemoved.has( index ) || pairedAdded.has( index ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( modifications.has( index ) ) {\n\t\t\t\treturn modifications.get( index );\n\t\t\t}\n\t\t\treturn block;\n\t\t} )\n\t\t.filter( Boolean );\n}\n\n/**\n * Diff raw block arrays using LCS, recursively handling innerBlocks.\n * Detects modifications when exactly 1 block is removed and 1 is added\n * with the same blockName (1:1 replacement = modification).\n *\n * Whitespace-only freeform pseudo-blocks are filtered at every recursive\n * level so this function is safe to call directly with raw output from\n * `@wordpress/block-serialization-default-parser`. The duplicate work for\n * inner-block recursion is negligible and keeps the contract self-contained.\n *\n * @param {Array} currentRaw Current revision's raw blocks.\n * @param {Array} previousRaw Previous revision's raw blocks.\n * @return {Array} Merged raw blocks with diff status injected.\n */\nfunction diffRawBlocks( currentRaw, previousRaw ) {\n\t// Strip whitespace-only freeform pseudo-blocks before LCS — see\n\t// `isWhitespaceRawBlock` for why.\n\tcurrentRaw = currentRaw.filter( ( b ) => ! isWhitespaceRawBlock( b ) );\n\tpreviousRaw = previousRaw.filter( ( b ) => ! isWhitespaceRawBlock( b ) );\n\n\tconst createBlockSignature = ( rawBlock ) =>\n\t\tJSON.stringify( {\n\t\t\tname: rawBlock.blockName,\n\t\t\tattrs: rawBlock.attrs,\n\t\t\t// Use innerContent filtered to non-null and non-whitespace-only strings.\n\t\t\t// This excludes whitespace between inner blocks which changes based on count.\n\t\t\thtml: ( rawBlock.innerContent || [] ).filter(\n\t\t\t\t( c ) => c !== null && c.trim() !== ''\n\t\t\t),\n\t\t} );\n\tconst currentSigs = currentRaw.map( createBlockSignature );\n\tconst previousSigs = previousRaw.map( createBlockSignature );\n\n\tconst diff = diffArrays( previousSigs, currentSigs );\n\n\tconst result = [];\n\tlet currIdx = 0;\n\tlet prevIdx = 0;\n\n\tfor ( const part of diff ) {\n\t\tif ( part.added ) {\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\t...currentRaw[ currIdx++ ],\n\t\t\t\t\t__revisionDiffStatus: { status: 'added' },\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if ( part.removed ) {\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tresult.push( {\n\t\t\t\t\t...previousRaw[ prevIdx++ ],\n\t\t\t\t\t__revisionDiffStatus: { status: 'removed' },\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Matched blocks - recursively diff their innerBlocks.\n\t\t\tfor ( let i = 0; i < part.count; i++ ) {\n\t\t\t\tconst currBlock = currentRaw[ currIdx++ ];\n\t\t\t\tconst prevBlock = previousRaw[ prevIdx++ ];\n\n\t\t\t\t// Recursively diff inner blocks.\n\t\t\t\tconst diffedInnerBlocks = diffRawBlocks(\n\t\t\t\t\tcurrBlock.innerBlocks || [],\n\t\t\t\t\tprevBlock.innerBlocks || []\n\t\t\t\t);\n\n\t\t\t\tresult.push( {\n\t\t\t\t\t...currBlock,\n\t\t\t\t\tinnerBlocks: diffedInnerBlocks,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Post-process to pair similar removed/added blocks as modifications.\n\treturn pairSimilarBlocks( result );\n}\n\n/**\n * Check if formatting has changed at specific character indices.\n *\n * @param {Array} currentFormats Current formats array.\n * @param {Array} previousFormats Previous formats array.\n * @param {number} currentIndex Character index in current.\n * @param {number} previousIndex Character index in previous.\n * @return {boolean} True if formatting changed at these indices.\n */\nfunction hasFormatChangedAtIndex(\n\tcurrentFormats,\n\tpreviousFormats,\n\tcurrentIndex,\n\tpreviousIndex\n) {\n\tconst currFmts = currentFormats[ currentIndex ] || [];\n\tconst prevFmts = previousFormats[ previousIndex ] || [];\n\n\tif ( currFmts.length !== prevFmts.length ) {\n\t\treturn true;\n\t}\n\n\t// Check if each format in current exists in previous\n\tfor ( const fmt of currFmts ) {\n\t\tconst match = prevFmts.find(\n\t\t\t( pf ) =>\n\t\t\t\tpf.type === fmt.type &&\n\t\t\t\tJSON.stringify( pf.attributes ) ===\n\t\t\t\t\tJSON.stringify( fmt.attributes )\n\t\t);\n\t\tif ( ! match ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Analyze what formatting changed between two character positions.\n * Returns both the change type (for styling) and a description (for tooltip).\n *\n * @param {Array} currentFormats Current formats array.\n * @param {Array} previousFormats Previous formats array.\n * @param {number} currIdx Character index in current.\n * @param {number} prevIdx Character index in previous.\n * @return {{ type: 'added'|'removed'|'changed', description: string }} Change info.\n */\nfunction describeFormatChange(\n\tcurrentFormats,\n\tpreviousFormats,\n\tcurrIdx,\n\tprevIdx\n) {\n\tconst currFmts = currentFormats[ currIdx ] || [];\n\tconst prevFmts = previousFormats[ prevIdx ] || [];\n\n\tlet addedCount = 0;\n\tlet removedCount = 0;\n\tlet changedCount = 0;\n\n\t// Find added formats and attribute changes\n\tfor ( const fmt of currFmts ) {\n\t\tconst match = prevFmts.find( ( pf ) => pf.type === fmt.type );\n\t\tif ( ! match ) {\n\t\t\taddedCount++;\n\t\t} else if (\n\t\t\tJSON.stringify( fmt.attributes ) !==\n\t\t\tJSON.stringify( match.attributes )\n\t\t) {\n\t\t\tchangedCount++;\n\t\t}\n\t}\n\n\t// Find removed formats\n\tfor ( const fmt of prevFmts ) {\n\t\tconst match = currFmts.find( ( cf ) => cf.type === fmt.type );\n\t\tif ( ! match ) {\n\t\t\tremovedCount++;\n\t\t}\n\t}\n\n\t// Determine primary change type for styling\n\tif ( addedCount > 0 && removedCount === 0 && changedCount === 0 ) {\n\t\treturn {\n\t\t\ttype: 'added',\n\t\t\tdescription: sprintf(\n\t\t\t\t/* translators: %d: number of formats added */\n\t\t\t\t_n( '%d format added', '%d formats added', addedCount ),\n\t\t\t\taddedCount\n\t\t\t),\n\t\t};\n\t}\n\tif ( removedCount > 0 && addedCount === 0 && changedCount === 0 ) {\n\t\treturn {\n\t\t\ttype: 'removed',\n\t\t\tdescription: sprintf(\n\t\t\t\t/* translators: %d: number of formats removed */\n\t\t\t\t_n( '%d format removed', '%d formats removed', removedCount ),\n\t\t\t\tremovedCount\n\t\t\t),\n\t\t};\n\t}\n\n\t// Mixed or attribute-only changes\n\tconst parts = [];\n\tif ( addedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats added */\n\t\t\t\t_n( '%d format added', '%d formats added', addedCount ),\n\t\t\t\taddedCount\n\t\t\t)\n\t\t);\n\t}\n\tif ( removedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats removed */\n\t\t\t\t_n( '%d format removed', '%d formats removed', removedCount ),\n\t\t\t\tremovedCount\n\t\t\t)\n\t\t);\n\t}\n\tif ( changedCount > 0 ) {\n\t\tparts.push(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of formats changed */\n\t\t\t\t_n( '%d format changed', '%d formats changed', changedCount ),\n\t\t\t\tchangedCount\n\t\t\t)\n\t\t);\n\t}\n\treturn {\n\t\ttype: 'changed',\n\t\tdescription: parts.join( ', ' ) || __( 'Formatting changed' ),\n\t};\n}\n\n/**\n * Apply inline diff formatting comparing two RichTextData values.\n * - Text changes: apply revision/diff-removed and revision/diff-added formats\n * - Format-only changes (text unchanged): apply revision/diff-format-changed format\n *\n * @param {RichTextData} currentRichText Current revision's rich text.\n * @param {RichTextData} previousRichText Previous revision's rich text.\n * @return {RichTextData} New rich text with diff formatting applied.\n */\nfunction applyRichTextDiff( currentRichText, previousRichText ) {\n\tconst currentText = currentRichText.toPlainText();\n\tconst previousText = previousRichText.toPlainText();\n\n\t// Diff the plain text (words for cleaner output).\n\tconst textDiff = diffWordsWithSpace( previousText, currentText );\n\n\tlet result = create( { text: '' } );\n\tlet currentIdx = 0;\n\tlet previousIdx = 0;\n\n\tfor ( const part of textDiff ) {\n\t\tif ( part.removed ) {\n\t\t\t// Text deleted - slice from PREVIOUS, apply <del>\n\t\t\tconst removedSlice = slice(\n\t\t\t\tpreviousRichText,\n\t\t\t\tpreviousIdx,\n\t\t\t\tpreviousIdx + part.value.length\n\t\t\t);\n\t\t\tconst formatted = applyFormat(\n\t\t\t\tremovedSlice,\n\t\t\t\t{\n\t\t\t\t\ttype: 'revision/diff-removed',\n\t\t\t\t\tattributes: { title: __( 'Removed' ) },\n\t\t\t\t},\n\t\t\t\t0,\n\t\t\t\tpart.value.length\n\t\t\t);\n\t\t\tresult = concat( result, formatted );\n\t\t\tpreviousIdx += part.value.length;\n\t\t} else if ( part.added ) {\n\t\t\t// Text added - slice from CURRENT, apply <ins>\n\t\t\tconst addedSlice = slice(\n\t\t\t\tcurrentRichText,\n\t\t\t\tcurrentIdx,\n\t\t\t\tcurrentIdx + part.value.length\n\t\t\t);\n\t\t\tconst formatted = applyFormat(\n\t\t\t\taddedSlice,\n\t\t\t\t{\n\t\t\t\t\ttype: 'revision/diff-added',\n\t\t\t\t\tattributes: { title: __( 'Added' ) },\n\t\t\t\t},\n\t\t\t\t0,\n\t\t\t\tpart.value.length\n\t\t\t);\n\t\t\tresult = concat( result, formatted );\n\t\t\tcurrentIdx += part.value.length;\n\t\t} else {\n\t\t\t// Text unchanged - check formatting at each character position.\n\t\t\t// Only apply <mark> to specific ranges where formatting differs.\n\t\t\tconst currentFormats = currentRichText.formats || [];\n\t\t\tconst previousFormats = previousRichText.formats || [];\n\t\t\tconst len = part.value.length;\n\n\t\t\t// Helper to check format change at offset within this unchanged part.\n\t\t\tconst checkFormatChanged = ( offset ) =>\n\t\t\t\thasFormatChangedAtIndex(\n\t\t\t\t\tcurrentFormats,\n\t\t\t\t\tpreviousFormats,\n\t\t\t\t\tcurrentIdx + offset,\n\t\t\t\t\tpreviousIdx + offset\n\t\t\t\t);\n\n\t\t\t// Find ranges of characters grouped by whether format changed.\n\t\t\tlet rangeStart = 0;\n\t\t\tlet rangeFormatChanged = checkFormatChanged( 0 );\n\n\t\t\tfor ( let i = 1; i <= len; i++ ) {\n\t\t\t\tconst formatChanged = i < len && checkFormatChanged( i );\n\n\t\t\t\t// When format-changed status changes or we reach the end, emit range.\n\t\t\t\tif ( i === len || formatChanged !== rangeFormatChanged ) {\n\t\t\t\t\tconst rangeSlice = slice(\n\t\t\t\t\t\tcurrentRichText,\n\t\t\t\t\t\tcurrentIdx + rangeStart,\n\t\t\t\t\t\tcurrentIdx + i\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( rangeFormatChanged ) {\n\t\t\t\t\t\t// Get type and description of what changed\n\t\t\t\t\t\tconst { type, description } = describeFormatChange(\n\t\t\t\t\t\t\tcurrentFormats,\n\t\t\t\t\t\t\tpreviousFormats,\n\t\t\t\t\t\t\tcurrentIdx + rangeStart,\n\t\t\t\t\t\t\tpreviousIdx + rangeStart\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Map change type to format type for styling\n\t\t\t\t\t\tconst formatType = {\n\t\t\t\t\t\t\tadded: 'revision/diff-format-added',\n\t\t\t\t\t\t\tremoved: 'revision/diff-format-removed',\n\t\t\t\t\t\t\tchanged: 'revision/diff-format-changed',\n\t\t\t\t\t\t}[ type ];\n\n\t\t\t\t\t\tconst marked = applyFormat(\n\t\t\t\t\t\t\trangeSlice,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: formatType,\n\t\t\t\t\t\t\t\tattributes: { title: description },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\ti - rangeStart\n\t\t\t\t\t\t);\n\t\t\t\t\t\tresult = concat( result, marked );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult = concat( result, rangeSlice );\n\t\t\t\t\t}\n\n\t\t\t\t\trangeStart = i;\n\t\t\t\t\trangeFormatChanged = formatChanged;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurrentIdx += part.value.length;\n\t\t\tpreviousIdx += part.value.length;\n\t\t}\n\t}\n\n\treturn new RichTextData( result );\n}\n\n/**\n * Apply diffs to a modified block's attributes.\n * - Rich-text attributes: applies inline diff formatting (ins/del marks).\n * - Other attributes: computes word-level diffs for the sidebar panel.\n *\n * @param {Object} currentBlock Current parsed block.\n * @param {Object} previousBlock Previous parsed block.\n * @param {Object} diffStatus The __revisionDiffStatus object to attach changedAttributes to.\n */\nfunction applyDiffToBlock( currentBlock, previousBlock, diffStatus ) {\n\tconst blockType = getBlockType( currentBlock.name );\n\tif ( ! blockType ) {\n\t\treturn;\n\t}\n\n\tconst changedAttributes = {};\n\n\tfor ( const [ attrName, attrDef ] of Object.entries(\n\t\tblockType.attributes\n\t) ) {\n\t\tif ( attrDef.source === 'rich-text' ) {\n\t\t\tconst currentRichText = currentBlock.attributes[ attrName ];\n\t\t\tconst previousRichText = previousBlock.attributes[ attrName ];\n\t\t\tif (\n\t\t\t\tcurrentRichText instanceof RichTextData &&\n\t\t\t\tpreviousRichText instanceof RichTextData\n\t\t\t) {\n\t\t\t\tcurrentBlock.attributes[ attrName ] = applyRichTextDiff(\n\t\t\t\t\tcurrentRichText,\n\t\t\t\t\tpreviousRichText\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst currStr = stringifyValue(\n\t\t\t\tcurrentBlock.attributes[ attrName ]\n\t\t\t);\n\t\t\tconst prevStr = stringifyValue(\n\t\t\t\tpreviousBlock.attributes[ attrName ]\n\t\t\t);\n\t\t\tif ( currStr !== prevStr ) {\n\t\t\t\tchangedAttributes[ attrName ] = diffWordsWithSpace(\n\t\t\t\t\tprevStr,\n\t\t\t\t\tcurrStr\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( Object.keys( changedAttributes ).length > 0 ) {\n\t\tdiffStatus.changedAttributes = changedAttributes;\n\t}\n}\n\n/**\n * Recursively apply diff status and rich text diff to blocks in the tree.\n * Copies __revisionDiffStatus from raw blocks to parsed blocks and applies\n * rich text diffs to modified blocks.\n *\n * @param {Object} parsedBlock Parsed block (with inner blocks).\n * @param {Object} rawBlock Raw block (with __revisionDiffStatus and __previousRawBlock).\n */\nfunction applyDiffRecursively( parsedBlock, rawBlock ) {\n\t// Copy diff status from raw block to parsed block.\n\tif ( rawBlock.__revisionDiffStatus ) {\n\t\t// Apply diffs if this block is modified and has a previous raw block.\n\t\tif (\n\t\t\trawBlock.__revisionDiffStatus.status === 'modified' &&\n\t\t\trawBlock.__previousRawBlock\n\t\t) {\n\t\t\tconst previousParsed = parseRawBlock( rawBlock.__previousRawBlock );\n\t\t\tif ( previousParsed ) {\n\t\t\t\tapplyDiffToBlock(\n\t\t\t\t\tparsedBlock,\n\t\t\t\t\tpreviousParsed,\n\t\t\t\t\trawBlock.__revisionDiffStatus\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tparsedBlock.__revisionDiffStatus = rawBlock.__revisionDiffStatus;\n\t\t// Also store in attributes so it survives block-editor store normalization.\n\t\tparsedBlock.attributes.__revisionDiffStatus =\n\t\t\trawBlock.__revisionDiffStatus;\n\t}\n\n\t// Recursively process inner blocks.\n\tif ( parsedBlock.innerBlocks && rawBlock.innerBlocks ) {\n\t\tfor ( let i = 0; i < parsedBlock.innerBlocks.length; i++ ) {\n\t\t\tconst parsedInner = parsedBlock.innerBlocks[ i ];\n\t\t\tconst rawInner = rawBlock.innerBlocks[ i ];\n\t\t\tif ( parsedInner && rawInner ) {\n\t\t\t\tapplyDiffRecursively( parsedInner, rawInner );\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Diff two revision contents at the grammar level.\n *\n * @param {string} currentContent Current revision's raw content.\n * @param {string} previousContent Previous revision's raw content.\n * @return {Array} Array of parsed blocks with diff status attributes.\n */\nexport function diffRevisionContent( currentContent, previousContent ) {\n\t// Grammar parse both contents.\n\tconst currentRaw = grammarParse( currentContent || '' );\n\tconst previousRaw = grammarParse( previousContent || '' );\n\n\t// Diff the raw block arrays.\n\tconst mergedRaw = diffRawBlocks( currentRaw, previousRaw );\n\n\t// Parse each raw block and apply diff status.\n\treturn mergedRaw\n\t\t.map( ( rawBlock ) => {\n\t\t\tconst parsed = parseRawBlock( rawBlock );\n\t\t\tif ( parsed ) {\n\t\t\t\tapplyDiffRecursively( parsed, rawBlock );\n\t\t\t}\n\t\t\treturn parsed;\n\t\t} )\n\t\t.filter( Boolean );\n}\n"],
5
5
  "mappings": ";AAQA,SAAS,YAAY,0BAA0B;AAK/C,SAAS,SAAS,oBAAoB;AACtC;AAAA,EACC,eAAe;AAAA,EACf;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,IAAI,IAAI,eAAe;AAKhC,SAAS,cAAc;AAEvB,IAAM,EAAE,cAAc,IAAI,O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AO;AAAA,EACR,CAAE,EACD,OAAQ,OAAQ;AACnB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-revisions-preview/diff-markers.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n// 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.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElementRef } = unlock( blockEditorPrivateApis );\n\n/**\n * Recursively collect blocks with diff status.\n *\n * @param {Array} blocks The blocks to search.\n * @return {Array} Blocks with __revisionDiffStatus.\n */\nfunction collectDiffBlocks( blocks ) {\n\tconst result = [];\n\tfor ( const block of blocks ) {\n\t\tif ( block.__revisionDiffStatus?.status ) {\n\t\t\tresult.push( {\n\t\t\t\tclientId: block.clientId,\n\t\t\t\tstatus: block.__revisionDiffStatus.status,\n\t\t\t} );\n\t\t}\n\t\tif ( block.innerBlocks?.length ) {\n\t\t\tresult.push( ...collectDiffBlocks( block.innerBlocks ) );\n\t\t}\n\t}\n\treturn result;\n}\n\nconst STATUS_LABELS = {\n\tadded: __( 'Go to added block' ),\n\tremoved: __( 'Go to removed block' ),\n\tmodified: __( 'Go to modified block' ),\n};\n\nfunction calculatePosition( el ) {\n\tif ( ! el ) {\n\t\treturn null;\n\t}\n\tconst doc = el.ownerDocument;\n\tconst scrollHeight = doc.documentElement.scrollHeight;\n\tconst rect = el.getBoundingClientRect();\n\tconst scrollTop = doc.documentElement.scrollTop;\n\tconst top = rect.top + scrollTop;\n\treturn {\n\t\ttop: ( top / scrollHeight ) * 100,\n\t\theight: ( rect.height / scrollHeight ) * 100,\n\t};\n}\n\n/**\n * Button component for a single diff marker.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The block client ID.\n * @param {string} props.status The diff status (added/removed/modified).\n * @param {Function} props.subscribe Function to subscribe to position updates.\n * @return {React.JSX.Element} The diff marker button or null if position not calculated.\n */\nfunction DiffMarkerButton( { clientId, status, subscribe } ) {\n\tconst blockRef = useRef();\n\tuseBlockElementRef( clientId, blockRef );\n\tconst [ position, setPosition ] = useState( () =>\n\t\tcalculatePosition( blockRef.current )\n\t);\n\n\tuseEffect( () => {\n\t\treturn subscribe( () => {\n\t\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t\t} );\n\t}, [ subscribe ] );\n\n\tuseEffect( () => {\n\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t}, [ status ] );\n\n\tif ( ! position ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Tooltip.Root>\n\t\t\t<Tooltip.Trigger\n\t\t\t\trender={\n\t\t\t\t\t<button\n\t\t\t\t\t\tclassName={ `revision-diff-marker is-${ status }` }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\ttop: `${ position.top }%`,\n\t\t\t\t\t\t\theight: `${ Math.max( position.height, 0.5 ) }%`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ () => blockRef.current?.focus() }\n\t\t\t\t\t\taria-label={ STATUS_LABELS[ status ] }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Tooltip.Popup>{ STATUS_LABELS[ status ] }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\n/**\n * Hook that provides diff markers functionality.\n * Returns a ref callback for the content element and a DiffMarkers component.\n * Must be used inside a BlockEditorProvider context.\n *\n * @return {Array} Tuple of [contentRef, DiffMarkersComponent].\n */\nexport function useDiffMarkers() {\n\tconst [ isMounted, setIsMounted ] = useState( false );\n\tconst subscribersRef = useRef( new Set() );\n\tconst blocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks(),\n\t\t[]\n\t);\n\tconst diffBlocks = useMemo( () => collectDiffBlocks( blocks ), [ blocks ] );\n\tconst subscribe = useCallback( ( callback ) => {\n\t\tsubscribersRef.current.add( callback );\n\t\treturn () => subscribersRef.current.delete( callback );\n\t}, [] );\n\tconst contentRef = useRefEffect( ( element ) => {\n\t\tconst { ownerDocument } = element;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst resizeObserver = new defaultView.ResizeObserver( () => {\n\t\t\tsubscribersRef.current.forEach( ( cb ) => cb() );\n\t\t} );\n\t\tresizeObserver.observe( ownerDocument.body );\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [] );\n\treturn [\n\t\tuseMergeRefs( [ contentRef, setIsMounted ] ),\n\t\t<div\n\t\t\tkey=\"diff-markers\"\n\t\t\tclassName=\"revision-diff-markers\"\n\t\t\trole=\"navigation\"\n\t\t\taria-label={ __( 'Document changes' ) }\n\t\t>\n\t\t\t{ isMounted &&\n\t\t\t\tdiffBlocks.map( ( { clientId, status } ) => (\n\t\t\t\t\t<DiffMarkerButton\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tstatus={ status }\n\t\t\t\t\t\tsubscribe={ subscribe }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t</div>,\n\t];\n}\n"],
5
- "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc,oBAAoB;AAC3C,SAAS,iBAAiB;AAC1B;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AAEnB,SAAS,eAAe;AAKxB,SAAS,cAAc;AA8ErB,SAG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AAW;AAAA,IAC3B;AAAA,EACD,GAAG,CAAC,CAAE;AACN,SAAO;AAAA,IACN,aAAc,CAAE,YAAY,YAAa,CAAE;AAAA,IAC3C;AAAA,MAAC;AAAA;AAAA,QAEA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAa,GAAI,kBAAmB;AAAA,QAElC,uBACD,WAAW,IAAK,CAAE,EAAE,UAAU,OAAO,MACpC;AAAA,UAAC;AAAA;AAAA,YAEA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,UAHM;AAAA,QAIP,CACC;AAAA;AAAA,MAbC;AAAA,IAcL;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElementRef } = unlock( blockEditorPrivateApis );\n\n/**\n * Recursively collect blocks with diff status.\n *\n * @param {Array} blocks The blocks to search.\n * @return {Array} Blocks with __revisionDiffStatus.\n */\nfunction collectDiffBlocks( blocks ) {\n\tconst result = [];\n\tfor ( const block of blocks ) {\n\t\tif ( block.__revisionDiffStatus?.status ) {\n\t\t\tresult.push( {\n\t\t\t\tclientId: block.clientId,\n\t\t\t\tstatus: block.__revisionDiffStatus.status,\n\t\t\t} );\n\t\t}\n\t\tif ( block.innerBlocks?.length ) {\n\t\t\tresult.push( ...collectDiffBlocks( block.innerBlocks ) );\n\t\t}\n\t}\n\treturn result;\n}\n\nconst STATUS_LABELS = {\n\tadded: __( 'Go to added block' ),\n\tremoved: __( 'Go to removed block' ),\n\tmodified: __( 'Go to modified block' ),\n};\n\nfunction calculatePosition( el ) {\n\tif ( ! el ) {\n\t\treturn null;\n\t}\n\tconst doc = el.ownerDocument;\n\tconst scrollHeight = doc.documentElement.scrollHeight;\n\tconst rect = el.getBoundingClientRect();\n\tconst scrollTop = doc.documentElement.scrollTop;\n\tconst top = rect.top + scrollTop;\n\treturn {\n\t\ttop: ( top / scrollHeight ) * 100,\n\t\theight: ( rect.height / scrollHeight ) * 100,\n\t};\n}\n\n/**\n * Button component for a single diff marker.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The block client ID.\n * @param {string} props.status The diff status (added/removed/modified).\n * @param {Function} props.subscribe Function to subscribe to position updates.\n * @return {React.JSX.Element} The diff marker button or null if position not calculated.\n */\nfunction DiffMarkerButton( { clientId, status, subscribe } ) {\n\tconst blockRef = useRef();\n\tuseBlockElementRef( clientId, blockRef );\n\tconst [ position, setPosition ] = useState( () =>\n\t\tcalculatePosition( blockRef.current )\n\t);\n\n\tuseEffect( () => {\n\t\treturn subscribe( () => {\n\t\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t\t} );\n\t}, [ subscribe ] );\n\n\tuseEffect( () => {\n\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t}, [ status ] );\n\n\tif ( ! position ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Tooltip.Root>\n\t\t\t<Tooltip.Trigger\n\t\t\t\trender={\n\t\t\t\t\t<button\n\t\t\t\t\t\tclassName={ `revision-diff-marker is-${ status }` }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\ttop: `${ position.top }%`,\n\t\t\t\t\t\t\theight: `${ Math.max( position.height, 0.5 ) }%`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ () => blockRef.current?.focus() }\n\t\t\t\t\t\taria-label={ STATUS_LABELS[ status ] }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Tooltip.Popup>{ STATUS_LABELS[ status ] }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\n/**\n * Hook that provides diff markers functionality.\n * Returns a ref callback for the content element and a DiffMarkers component.\n * Must be used inside a BlockEditorProvider context.\n *\n * @return {Array} Tuple of [contentRef, DiffMarkersComponent].\n */\nexport function useDiffMarkers() {\n\tconst [ isMounted, setIsMounted ] = useState( false );\n\tconst subscribersRef = useRef( new Set() );\n\tconst blocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks(),\n\t\t[]\n\t);\n\tconst diffBlocks = useMemo( () => collectDiffBlocks( blocks ), [ blocks ] );\n\tconst subscribe = useCallback( ( callback ) => {\n\t\tsubscribersRef.current.add( callback );\n\t\treturn () => subscribersRef.current.delete( callback );\n\t}, [] );\n\tconst contentRef = useRefEffect( ( element ) => {\n\t\tconst { ownerDocument } = element;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst resizeObserver = new defaultView.ResizeObserver( () => {\n\t\t\tsubscribersRef.current.forEach( ( cb ) => cb() );\n\t\t} );\n\t\tresizeObserver.observe( ownerDocument.body );\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [] );\n\treturn [\n\t\tuseMergeRefs( [ contentRef, setIsMounted ] ),\n\t\t<div\n\t\t\tkey=\"diff-markers\"\n\t\t\tclassName=\"revision-diff-markers\"\n\t\t\trole=\"navigation\"\n\t\t\taria-label={ __( 'Document changes' ) }\n\t\t>\n\t\t\t{ isMounted &&\n\t\t\t\tdiffBlocks.map( ( { clientId, status } ) => (\n\t\t\t\t\t<DiffMarkerButton\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tstatus={ status }\n\t\t\t\t\t\tsubscribe={ subscribe }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t</div>,\n\t];\n}\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc,oBA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gB,MAAM;AAC5D,qBAAe,QAAQ,QAAS,CAAE,OAAQ,GAAG,CAAE;AAAA,IAChD,CAAE;AACF,mBAAe,QAAS,cAAc,IAAK;AAC3C,WAAO,MAAM;AACZ,qBAAe,WAAW;AAAA,IAC3B;AAAA,EACD,GAAG,CAAC,CAAE;AACN,SAAO;AAAA,IACN,aAAc,CAAE,YAAY,YAAa,CAAE;AAAA,IAC3C;AAAA,MAAC;AAAA;AAAA,QAEA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAa,GAAI,kBAAmB;AAAA,QAElC,uBACD,WAAW,IAAK,CAAE,EAAE,UAAU,OAAO,MACpC;AAAA,UAAC;AAAA;AAAA,YAEA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,UAHM;AAAA,QAIP,CACC;AAAA;AAAA,MAbC;AAAA,IAcL;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -85,7 +85,7 @@ function RevisionsSlider() {
85
85
  const start = Math.max(1, end - perPage + 1);
86
86
  return sprintf(
87
87
  /* translators: 1: first revision number, 2: last revision number */
88
- __("Revisions %1$s\u2013%2$s"),
88
+ __("Revisions %1$s–%2$s"),
89
89
  start,
90
90
  end
91
91
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-revisions-preview/revisions-slider.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { RangeControl, Spinner, Button } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\nimport { useMemo } from '@wordpress/element';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Slider component for navigating revisions with pagination.\n *\n * @return {React.JSX.Element} The revisions slider component.\n */\nfunction RevisionsSlider() {\n\tconst {\n\t\trevisions: rawRevisions,\n\t\tperPage,\n\t\tcurrentRevisionId,\n\t\trevisionKey,\n\t\trevisionPage,\n\t\ttotalRevisions,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentRevisionId,\n\t\t\tgetRevisionPage,\n\t\t\tgetPageRevisions,\n\t\t\tgetRevisionsPerPage,\n\t\t} = unlock( select( editorStore ) );\n\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tif ( ! postType ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst entityConfig = select( coreStore ).getEntityConfig(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\tconst _revisionPage = getRevisionPage();\n\n\t\treturn {\n\t\t\trevisions: getPageRevisions( _revisionPage ),\n\t\t\tperPage: getRevisionsPerPage(),\n\t\t\tcurrentRevisionId: getCurrentRevisionId(),\n\t\t\trevisionKey: _revisionKey,\n\t\t\trevisionPage: _revisionPage,\n\t\t\ttotalRevisions:\n\t\t\t\tselect( editorStore ).getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n\n\tconst { setCurrentRevisionId, setRevisionPage } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst isLoading = ! rawRevisions;\n\tconst totalPages = Math.ceil( totalRevisions / perPage ) || 1;\n\n\t// Reverse desc\u2192asc so the slider reads oldest (left) \u2192 newest (right).\n\tconst revisions = useMemo(\n\t\t() => rawRevisions && [ ...rawRevisions ].reverse(),\n\t\t[ rawRevisions ]\n\t);\n\n\tconst selectedIndex = revisions?.findIndex(\n\t\t( r ) => r[ revisionKey ] === currentRevisionId\n\t);\n\n\tconst handleSliderChange = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( revision ) {\n\t\t\tsetCurrentRevisionId( revision[ revisionKey ] );\n\t\t}\n\t};\n\n\t// Format date for tooltip.\n\tconst dateSettings = getDateSettings();\n\tconst renderTooltipContent = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( ! revision ) {\n\t\t\treturn index;\n\t\t}\n\t\treturn dateI18n( dateSettings.formats.datetime, revision.date );\n\t};\n\n\tconst showPagination = totalPages > 1;\n\n\tif ( isLoading && ! showPagination ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( ! isLoading && ! revisions?.length ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'No revisions found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( totalRevisions <= 1 ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'Only one revision found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tconst getPageRangeLabel = ( page ) => {\n\t\tconst end = totalRevisions - ( page - 1 ) * perPage;\n\t\tconst start = Math.max( 1, end - perPage + 1 );\n\t\treturn sprintf(\n\t\t\t/* translators: 1: first revision number, 2: last revision number */\n\t\t\t__( 'Revisions %1$s\u2013%2$s' ),\n\t\t\tstart,\n\t\t\tend\n\t\t);\n\t};\n\n\tconst sliderOrSpinner =\n\t\tisLoading || selectedIndex === -1 ? (\n\t\t\t<Spinner />\n\t\t) : (\n\t\t\t<RangeControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\taria-valuetext={ renderTooltipContent( selectedIndex ) }\n\t\t\t\tclassName=\"editor-revisions-header__slider\"\n\t\t\t\thideLabelFromVision\n\t\t\t\tlabel={ __( 'Revision' ) }\n\t\t\t\tmax={ revisions?.length - 1 }\n\t\t\t\tmin={ 0 }\n\t\t\t\tmarks\n\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\tvalue={ selectedIndex }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t);\n\n\tif ( ! showPagination ) {\n\t\treturn sliderOrSpinner;\n\t}\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" style={ { flex: 1 } }>\n\t\t\t<Button\n\t\t\t\ticon={ chevronLeft }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage < totalPages\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage + 1 )\n\t\t\t\t\t\t: __( 'No older revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage + 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage >= totalPages }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tflex: 1,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ sliderOrSpinner }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\ticon={ chevronRight }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage > 1\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage - 1 )\n\t\t\t\t\t\t: __( 'No newer revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage - 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage <= 1 }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n\nexport default RevisionsSlider;\n"],
5
- "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc,SAAS,cAAc;AAC9C,SAAS,SAAS,iBAAiB;AACnC,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,eAAe,uBAAuB;AACzD,SAAS,eAAe;AACxB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,aAAa;AAKtB,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAmFd,cAuDP,YAvDO;AA5ET,S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CAAE,IACpC,GAAI,oBAAqB;AAAA,QAE7B,SAAU,MAAM,gBAAiB,eAAe,CAAE;AAAA,QAClD,UAAW,aAAa,gBAAgB;AAAA,QACxC,MAAK;AAAA,QACL,wBAAsB;AAAA;AAAA,IACvB;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,UACP,MAAM;AAAA,UACN,UAAU;AAAA,UACV,SAAS;AAAA,UACT,gBAAgB;AAAA,QACjB;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,OACC,eAAe,IACZ,kBAAmB,eAAe,CAAE,IACpC,GAAI,oBAAqB;AAAA,QAE7B,SAAU,MAAM,gBAAiB,eAAe,CAAE;AAAA,QAClD,UAAW,aAAa,gBAAgB;AAAA,QACxC,MAAK;AAAA,QACL,wBAAsB;AAAA;AAAA,IACvB;AAAA,KACD;AAEF;AAEA,IAAO,2BAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { RangeControl, Spinner, Button } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\nimport { useMemo } from '@wordpress/element';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Slider component for navigating revisions with pagination.\n *\n * @return {React.JSX.Element} The revisions slider component.\n */\nfunction RevisionsSlider() {\n\tconst {\n\t\trevisions: rawRevisions,\n\t\tperPage,\n\t\tcurrentRevisionId,\n\t\trevisionKey,\n\t\trevisionPage,\n\t\ttotalRevisions,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentRevisionId,\n\t\t\tgetRevisionPage,\n\t\t\tgetPageRevisions,\n\t\t\tgetRevisionsPerPage,\n\t\t} = unlock( select( editorStore ) );\n\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tif ( ! postType ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst entityConfig = select( coreStore ).getEntityConfig(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\tconst _revisionPage = getRevisionPage();\n\n\t\treturn {\n\t\t\trevisions: getPageRevisions( _revisionPage ),\n\t\t\tperPage: getRevisionsPerPage(),\n\t\t\tcurrentRevisionId: getCurrentRevisionId(),\n\t\t\trevisionKey: _revisionKey,\n\t\t\trevisionPage: _revisionPage,\n\t\t\ttotalRevisions:\n\t\t\t\tselect( editorStore ).getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n\n\tconst { setCurrentRevisionId, setRevisionPage } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst isLoading = ! rawRevisions;\n\tconst totalPages = Math.ceil( totalRevisions / perPage ) || 1;\n\n\t// Reverse desc→asc so the slider reads oldest (left) newest (right).\n\tconst revisions = useMemo(\n\t\t() => rawRevisions && [ ...rawRevisions ].reverse(),\n\t\t[ rawRevisions ]\n\t);\n\n\tconst selectedIndex = revisions?.findIndex(\n\t\t( r ) => r[ revisionKey ] === currentRevisionId\n\t);\n\n\tconst handleSliderChange = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( revision ) {\n\t\t\tsetCurrentRevisionId( revision[ revisionKey ] );\n\t\t}\n\t};\n\n\t// Format date for tooltip.\n\tconst dateSettings = getDateSettings();\n\tconst renderTooltipContent = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( ! revision ) {\n\t\t\treturn index;\n\t\t}\n\t\treturn dateI18n( dateSettings.formats.datetime, revision.date );\n\t};\n\n\tconst showPagination = totalPages > 1;\n\n\tif ( isLoading && ! showPagination ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( ! isLoading && ! revisions?.length ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'No revisions found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( totalRevisions <= 1 ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'Only one revision found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tconst getPageRangeLabel = ( page ) => {\n\t\tconst end = totalRevisions - ( page - 1 ) * perPage;\n\t\tconst start = Math.max( 1, end - perPage + 1 );\n\t\treturn sprintf(\n\t\t\t/* translators: 1: first revision number, 2: last revision number */\n\t\t\t__( 'Revisions %1$s–%2$s' ),\n\t\t\tstart,\n\t\t\tend\n\t\t);\n\t};\n\n\tconst sliderOrSpinner =\n\t\tisLoading || selectedIndex === -1 ? (\n\t\t\t<Spinner />\n\t\t) : (\n\t\t\t<RangeControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\taria-valuetext={ renderTooltipContent( selectedIndex ) }\n\t\t\t\tclassName=\"editor-revisions-header__slider\"\n\t\t\t\thideLabelFromVision\n\t\t\t\tlabel={ __( 'Revision' ) }\n\t\t\t\tmax={ revisions?.length - 1 }\n\t\t\t\tmin={ 0 }\n\t\t\t\tmarks\n\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\tvalue={ selectedIndex }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t);\n\n\tif ( ! showPagination ) {\n\t\treturn sliderOrSpinner;\n\t}\n\n\treturn (\n\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" style={ { flex: 1 } }>\n\t\t\t<Button\n\t\t\t\ticon={ chevronLeft }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage < totalPages\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage + 1 )\n\t\t\t\t\t\t: __( 'No older revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage + 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage >= totalPages }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tflex: 1,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ sliderOrSpinner }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\ticon={ chevronRight }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage > 1\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage - 1 )\n\t\t\t\t\t\t: __( 'No newer revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage - 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage <= 1 }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n\nexport default RevisionsSlider;\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc,SAAS,cAAc;AAC9C,SAAS,SAAS,iBAAiB;AACnC,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,eAAe,uBAAuB;AACzD,SAAS,eAAe;AACxB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,aAAa;AAKtB,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAmFd,cAuDP,YAvDO;AA5ET,SAAS,kBAAkB;AAC1B,QAAM;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,OAAQ,WAAY,CAAE;AAElC,UAA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AAA,UACV,SAAS;AAAA,UACT,gBAAgB;AAAA,QACjB;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO;AAAA,QACP,OACC,eAAe,IACZ,kBAAmB,eAAe,CAAE,IACpC,GAAI,oBAAqB;AAAA,QAE7B,SAAU,MAAM,gBAAiB,eAAe,CAAE;AAAA,QAClD,UAAW,aAAa,gBAAgB;AAAA,QACxC,MAAK;AAAA,QACL,wBAAsB;AAAA;AAAA,IACvB;AAAA,KACD;AAEF;AAEA,IAAO,2BAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,152 @@
1
+ // packages/editor/src/components/post-revisions-timeline/index.js
2
+ import { useSelect, useDispatch } from "@wordpress/data";
3
+ import { store as coreStore } from "@wordpress/core-data";
4
+ import { DataViewsPicker, filterSortAndPaginate } from "@wordpress/dataviews";
5
+ import { dateI18n, getDate, humanTimeDiff, getSettings } from "@wordpress/date";
6
+ import { useCallback, useEffect, useMemo, useState } from "@wordpress/element";
7
+ import { __ } from "@wordpress/i18n";
8
+ import { authorField } from "@wordpress/fields";
9
+ import { Text } from "@wordpress/ui";
10
+ import { store as editorStore } from "../../store/index.mjs";
11
+ import { unlock } from "../../lock-unlock.mjs";
12
+ import { PostContentInformationUI } from "../post-content-information/index.mjs";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var PAGE_SIZE = 10;
15
+ var EMPTY_ARRAY = [];
16
+ var defaultLayouts = { pickerActivity: true };
17
+ var baseView = {
18
+ type: "pickerActivity",
19
+ titleField: "date",
20
+ descriptionField: "details",
21
+ fields: ["author"],
22
+ layout: { density: "compact" },
23
+ page: 1,
24
+ perPage: PAGE_SIZE
25
+ };
26
+ var DAY_IN_MILLISECONDS = 864e5;
27
+ function getDisplayDate(value) {
28
+ const dateNowInMs = getDate(null).getTime();
29
+ const date = getDate(value ?? null);
30
+ return dateNowInMs - date.getTime() > DAY_IN_MILLISECONDS ? dateI18n(getSettings().formats.datetimeAbbreviated, date) : humanTimeDiff(date);
31
+ }
32
+ function PostRevisionsTimeline() {
33
+ const { setCurrentRevisionId } = unlock(useDispatch(editorStore));
34
+ const [view, setView] = useState(baseView);
35
+ const { revisions, revisionKey, currentRevisionId, currentRevision } = useSelect((select) => {
36
+ const { getCurrentPostType } = select(editorStore);
37
+ const {
38
+ getCurrentRevisionId: _getCurrentRevisionId,
39
+ getCurrentRevision,
40
+ getRevisionPage,
41
+ getPageRevisions
42
+ } = unlock(select(editorStore));
43
+ const { getEntityConfig } = select(coreStore);
44
+ const _postType = getCurrentPostType();
45
+ const entityConfig = getEntityConfig("postType", _postType);
46
+ const _revisionKey = entityConfig?.revisionKey || "id";
47
+ const _currentRevisionId = _getCurrentRevisionId();
48
+ return {
49
+ // Same desc-ordered window the header slider renders (warm cache).
50
+ revisions: getPageRevisions(getRevisionPage()),
51
+ revisionKey: _revisionKey,
52
+ currentRevisionId: _currentRevisionId,
53
+ currentRevision: _currentRevisionId ? getCurrentRevision() : void 0
54
+ };
55
+ }, []);
56
+ const postContent = currentRevision?.content?.raw;
57
+ const isLoading = !revisions;
58
+ const fields = useMemo(
59
+ () => [
60
+ {
61
+ id: "date",
62
+ label: __("Date"),
63
+ // Return the humanized label the row renders so the picker
64
+ // option's accessible name announces e.g. "5 minutes ago"
65
+ // instead of the raw ISO timestamp.
66
+ getValue: ({ item }) => getDisplayDate(item.date),
67
+ render: ({ item }) => /* @__PURE__ */ jsx(
68
+ Text,
69
+ {
70
+ variant: "heading-sm",
71
+ render: /* @__PURE__ */ jsx("time", { dateTime: item.date }),
72
+ children: getDisplayDate(item.date)
73
+ }
74
+ ),
75
+ enableSorting: false,
76
+ enableHiding: false
77
+ },
78
+ authorField,
79
+ {
80
+ id: "details",
81
+ label: __("Details"),
82
+ render: ({ item }) => {
83
+ if (String(item[revisionKey]) !== String(currentRevisionId)) {
84
+ return null;
85
+ }
86
+ return /* @__PURE__ */ jsx(PostContentInformationUI, { postContent });
87
+ },
88
+ enableSorting: false,
89
+ enableHiding: false
90
+ }
91
+ ],
92
+ [revisionKey, currentRevisionId, postContent]
93
+ );
94
+ const { data: shownRevisions, paginationInfo } = useMemo(
95
+ () => filterSortAndPaginate(revisions || EMPTY_ARRAY, view, fields),
96
+ [revisions, view, fields]
97
+ );
98
+ useEffect(() => {
99
+ if (!currentRevisionId || !revisions) {
100
+ return;
101
+ }
102
+ const index = revisions.findIndex(
103
+ (r) => String(r[revisionKey]) === String(currentRevisionId)
104
+ );
105
+ if (index < 0) {
106
+ return;
107
+ }
108
+ const page = Math.floor(index / view.perPage) + 1;
109
+ setView((v) => v.page === page ? v : { ...v, page });
110
+ }, [currentRevisionId, revisions, revisionKey, view.perPage]);
111
+ const selection = useMemo(
112
+ () => currentRevisionId ? [String(currentRevisionId)] : EMPTY_ARRAY,
113
+ [currentRevisionId]
114
+ );
115
+ const onChangeSelection = useCallback(
116
+ (newSelection) => {
117
+ if (newSelection.length === 0) {
118
+ return;
119
+ }
120
+ const selectedId = newSelection[newSelection.length - 1];
121
+ setCurrentRevisionId(Number(selectedId));
122
+ },
123
+ [setCurrentRevisionId]
124
+ );
125
+ const getItemId = useCallback(
126
+ (item) => String(item[revisionKey]),
127
+ [revisionKey]
128
+ );
129
+ return /* @__PURE__ */ jsx("div", { className: "editor-post-revisions-timeline", children: /* @__PURE__ */ jsxs(
130
+ DataViewsPicker,
131
+ {
132
+ view,
133
+ onChangeView: setView,
134
+ fields,
135
+ data: shownRevisions,
136
+ isLoading,
137
+ paginationInfo,
138
+ defaultLayouts,
139
+ getItemId,
140
+ selection,
141
+ onChangeSelection,
142
+ children: [
143
+ /* @__PURE__ */ jsx(DataViewsPicker.Layout, {}),
144
+ /* @__PURE__ */ jsx(DataViewsPicker.Footer, {})
145
+ ]
146
+ }
147
+ ) });
148
+ }
149
+ export {
150
+ PostRevisionsTimeline as default
151
+ };
152
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/post-revisions-timeline/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { DataViewsPicker, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\nimport { useCallback, useEffect, useMemo, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { authorField } from '@wordpress/fields';\nimport { Text } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { PostContentInformationUI } from '../post-content-information';\n\nconst PAGE_SIZE = 10;\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = { pickerActivity: true };\nconst baseView = {\n\ttype: 'pickerActivity',\n\ttitleField: 'date',\n\tdescriptionField: 'details',\n\tfields: [ 'author' ],\n\tlayout: { density: 'compact' },\n\tpage: 1,\n\tperPage: PAGE_SIZE,\n};\n\nconst DAY_IN_MILLISECONDS = 86400000;\n\nfunction getDisplayDate( value ) {\n\tconst dateNowInMs = getDate( null ).getTime();\n\tconst date = getDate( value ?? null );\n\treturn dateNowInMs - date.getTime() > DAY_IN_MILLISECONDS\n\t\t? dateI18n( getSettings().formats.datetimeAbbreviated, date )\n\t\t: humanTimeDiff( date );\n}\n\nexport default function PostRevisionsTimeline() {\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst [ view, setView ] = useState( baseView );\n\n\tconst { revisions, revisionKey, currentRevisionId, currentRevision } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst {\n\t\t\t\tgetCurrentRevisionId: _getCurrentRevisionId,\n\t\t\t\tgetCurrentRevision,\n\t\t\t\tgetRevisionPage,\n\t\t\t\tgetPageRevisions,\n\t\t\t} = unlock( select( editorStore ) );\n\t\t\tconst { getEntityConfig } = select( coreStore );\n\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst entityConfig = getEntityConfig( 'postType', _postType );\n\t\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\t\tconst _currentRevisionId = _getCurrentRevisionId();\n\n\t\t\treturn {\n\t\t\t\t// Same desc-ordered window the header slider renders (warm cache).\n\t\t\t\trevisions: getPageRevisions( getRevisionPage() ),\n\t\t\t\trevisionKey: _revisionKey,\n\t\t\t\tcurrentRevisionId: _currentRevisionId,\n\t\t\t\tcurrentRevision: _currentRevisionId\n\t\t\t\t\t? getCurrentRevision()\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [] );\n\n\tconst postContent = currentRevision?.content?.raw;\n\n\tconst isLoading = ! revisions;\n\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'date',\n\t\t\t\tlabel: __( 'Date' ),\n\t\t\t\t// Return the humanized label the row renders so the picker\n\t\t\t\t// option's accessible name announces e.g. \"5 minutes ago\"\n\t\t\t\t// instead of the raw ISO timestamp.\n\t\t\t\tgetValue: ( { item } ) => getDisplayDate( item.date ),\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tvariant=\"heading-sm\"\n\t\t\t\t\t\trender={ <time dateTime={ item.date } /> }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getDisplayDate( item.date ) }\n\t\t\t\t\t</Text>\n\t\t\t\t),\n\t\t\t\tenableSorting: false,\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\tauthorField,\n\t\t\t{\n\t\t\t\tid: 'details',\n\t\t\t\tlabel: __( 'Details' ),\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tString( item[ revisionKey ] ) !==\n\t\t\t\t\t\tString( currentRevisionId )\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PostContentInformationUI postContent={ postContent } />\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tenableSorting: false,\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t],\n\t\t[ revisionKey, currentRevisionId, postContent ]\n\t);\n\n\tconst { data: shownRevisions, paginationInfo } = useMemo(\n\t\t() => filterSortAndPaginate( revisions || EMPTY_ARRAY, view, fields ),\n\t\t[ revisions, view, fields ]\n\t);\n\n\t// Keep the selected revision visible: when it changes (e.g. the slider\n\t// scrubs), jump to the client-side page that contains it. Keyed on the\n\t// selection/data, not view.page, so manual paging stays free browsing.\n\tuseEffect( () => {\n\t\tif ( ! currentRevisionId || ! revisions ) {\n\t\t\treturn;\n\t\t}\n\t\tconst index = revisions.findIndex(\n\t\t\t( r ) => String( r[ revisionKey ] ) === String( currentRevisionId )\n\t\t);\n\t\tif ( index < 0 ) {\n\t\t\treturn;\n\t\t}\n\t\tconst page = Math.floor( index / view.perPage ) + 1;\n\t\tsetView( ( v ) => ( v.page === page ? v : { ...v, page } ) );\n\t}, [ currentRevisionId, revisions, revisionKey, view.perPage ] );\n\n\tconst selection = useMemo(\n\t\t() =>\n\t\t\tcurrentRevisionId ? [ String( currentRevisionId ) ] : EMPTY_ARRAY,\n\t\t[ currentRevisionId ]\n\t);\n\n\tconst onChangeSelection = useCallback(\n\t\t( newSelection ) => {\n\t\t\t// Revisions mode always keeps one revision selected. Clicking the\n\t\t\t// active revision yields an empty selection, which we ignore so the\n\t\t\t// timeline never ends up with nothing selected.\n\t\t\tif ( newSelection.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst selectedId = newSelection[ newSelection.length - 1 ];\n\t\t\tsetCurrentRevisionId( Number( selectedId ) );\n\t\t},\n\t\t[ setCurrentRevisionId ]\n\t);\n\n\tconst getItemId = useCallback(\n\t\t( item ) => String( item[ revisionKey ] ),\n\t\t[ revisionKey ]\n\t);\n\n\treturn (\n\t\t<div className=\"editor-post-revisions-timeline\">\n\t\t\t<DataViewsPicker\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ setView }\n\t\t\t\tfields={ fields }\n\t\t\t\tdata={ shownRevisions }\n\t\t\t\tisLoading={ isLoading }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\tgetItemId={ getItemId }\n\t\t\t\tselection={ selection }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t>\n\t\t\t\t<DataViewsPicker.Layout />\n\t\t\t\t<DataViewsPicker.Footer />\n\t\t\t</DataViewsPicker>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB,6BAA6B;AACvD,SAAS,UAAU,SAAS,eAAe,mBAAmB;AAC9D,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAC1D,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AAKrB,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,SAAS,gCAAgC;AAwE1B,cA+EZ,YA/EY;AAtEf,IAAM,YAAY;AAClB,IAAM,cAAc,CAAC;AACrB,IAAM,iBAAiB,EAAE,gBAAgB,KAAK;AAC9C,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,QAAQ,CAAE,QAAS;AAAA,EACnB,QAAQ,EAAE,SAAS,UAAU;AAAA,EAC7B,MAAM;AAAA,EACN,SAAS;AACV;AAEA,IAAM,sBAAsB;AAE5B,SAAS,eAAgB,OAAQ;AAChC,QAAM,cAAc,QAAS,IAAK,EAAE,QAAQ;AAC5C,QAAM,OAAO,QAAS,SAAS,IAAK;AACpC,SAAO,cAAc,KAAK,QAAQ,IAAI,sBACnC,SAAU,YAAY,EAAE,QAAQ,qBAAqB,IAAK,IAC1D,cAAe,IAAK;AACxB;AAEe,SAAR,wBAAyC;AAC/C,QAAM,E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E,WAAY;AAAA,EACf;AAEA,SACC,oBAAC,SAAI,WAAU,kCACd;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,cAAe;AAAA,MACf;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,4BAAC,gBAAgB,QAAhB,EAAuB;AAAA,QACxB,oBAAC,gBAAgB,QAAhB,EAAuB;AAAA;AAAA;AAAA,EACzB,GACD;AAEF;",
6
+ "names": []
7
+ }
@@ -26,6 +26,7 @@ function PostSavedState({ forceIsDirty }) {
26
26
  isSaveable,
27
27
  isSaving,
28
28
  isSavingLocked,
29
+ isSavingNonPostEntityChanges,
29
30
  isScheduled,
30
31
  hasPublishAction,
31
32
  showIconLabels,
@@ -34,34 +35,23 @@ function PostSavedState({ forceIsDirty }) {
34
35
  postType
35
36
  } = useSelect(
36
37
  (select) => {
37
- const {
38
- isEditedPostNew,
39
- isCurrentPostPublished,
40
- isCurrentPostScheduled,
41
- isEditedPostDirty,
42
- isSavingPost,
43
- isEditedPostSaveable,
44
- isPostSavingLocked,
45
- getCurrentPost,
46
- isAutosavingPost,
47
- getEditedPostAttribute,
48
- getPostEdits
49
- } = select(editorStore);
38
+ const store = select(editorStore);
50
39
  const { get } = select(preferencesStore);
51
40
  return {
52
- isAutosaving: isAutosavingPost(),
53
- isDirty: forceIsDirty || isEditedPostDirty(),
54
- isNew: isEditedPostNew(),
55
- isPublished: isCurrentPostPublished(),
56
- isSaving: isSavingPost(),
57
- isSaveable: isEditedPostSaveable(),
58
- isSavingLocked: isPostSavingLocked(),
59
- isScheduled: isCurrentPostScheduled(),
60
- hasPublishAction: getCurrentPost()?._links?.["wp:action-publish"] ?? false,
41
+ isAutosaving: store.isAutosavingPost(),
42
+ isDirty: forceIsDirty || store.isEditedPostDirty(),
43
+ isNew: store.isEditedPostNew(),
44
+ isPublished: store.isCurrentPostPublished(),
45
+ isSaving: store.isSavingPost(),
46
+ isSaveable: store.isEditedPostSaveable(),
47
+ isSavingLocked: store.isPostSavingLocked(),
48
+ isSavingNonPostEntityChanges: store.isSavingNonPostEntityChanges(),
49
+ isScheduled: store.isCurrentPostScheduled(),
50
+ hasPublishAction: !!store.getCurrentPost()?._links?.["wp:action-publish"],
61
51
  showIconLabels: get("core", "showIconLabels"),
62
- postStatus: getEditedPostAttribute("status"),
63
- postStatusHasChanged: !!getPostEdits()?.status,
64
- postType: select(editorStore).getCurrentPostType()
52
+ postStatus: store.getEditedPostAttribute("status"),
53
+ postStatusHasChanged: !!store.getPostEdits()?.status,
54
+ postType: store.getCurrentPostType()
65
55
  };
66
56
  },
67
57
  [forceIsDirty]
@@ -93,7 +83,8 @@ function PostSavedState({ forceIsDirty }) {
93
83
  const shortLabel = __("Save");
94
84
  const isSaved = forceSavedMessage || !isNew && !isDirty;
95
85
  const isSavedState = isSaving || isSaved;
96
- const isDisabled = isSaving || isSaved || !isSaveable || isSavingLocked;
86
+ const isDisabled = isSaving || isSaved || !isSaveable || isSavingLocked || // Disable while a non-post entity (e.g. a newly created term) is mid-save.
87
+ isSavingNonPostEntityChanges;
97
88
  let text;
98
89
  if (isSaving) {
99
90
  text = isAutosaving ? __("Autosaving") : __("Saving");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/post-saved-state/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STATUS_OPTIONS } from '../../components/post-status';\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE } from '../../store/constants';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {React.ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisSavingLocked,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t\tpostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tisPostSavingLocked,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetPostEdits,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisSavingLocked: isPostSavingLocked(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Attachments don't support draft mode, so hide this button.\n\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.\n\t// The reason for this is that this button handles the `save as pending` and `save draft` actions.\n\t// An exception for this is when the post has a custom status and there should be a way to save changes without\n\t// having to publish. This should be handled better in the future when custom statuses have better support.\n\t// @see https://github.com/WordPress/gutenberg/issues/3144.\n\tconst isIneligibleStatus =\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&\n\t\tSTATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\tisIneligibleStatus ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable || isSavingLocked;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],
5
- "mappings": ";AAGA,OAA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,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WACC,cAAc,WACX,KAAM;AAAA,QACN,0BAA0B,CAAE;AAAA,QAC5B,2BAA2B;AAAA,QAC3B,aAAa;AAAA,QACb,iBAAiB;AAAA,QACjB,YAAY;AAAA,QACZ,CAAE,oBAAqB;AAAA,UACtB,MAAM;AAAA,QACP,CAAE,CAAE,GAAG;AAAA,MACP,CAAE,IACF;AAAA,MAEJ,SAAU,aAAa,SAAY,MAAM,SAAS;AAAA,MAKlD,UAAW,aAAa,SAAY,gBAAgB,QAAS,GAAI;AAAA,MACjE,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAO,kBAAkB,SAAY;AAAA,MACrC,OAAQ,QAAQ;AAAA,MAChB,iBAAgB;AAAA,MAEd;AAAA,wBAAgB,oBAAC,QAAK,MAAO,UAAU,QAAQ,OAAQ;AAAA,QACvD;AAAA;AAAA;AAAA,EACH;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STATUS_OPTIONS } from '../../components/post-status';\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE } from '../../store/constants';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {React.ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisSavingLocked,\n\t\tisSavingNonPostEntityChanges,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t\tpostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst store = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: store.isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || store.isEditedPostDirty(),\n\t\t\t\tisNew: store.isEditedPostNew(),\n\t\t\t\tisPublished: store.isCurrentPostPublished(),\n\t\t\t\tisSaving: store.isSavingPost(),\n\t\t\t\tisSaveable: store.isEditedPostSaveable(),\n\t\t\t\tisSavingLocked: store.isPostSavingLocked(),\n\t\t\t\tisSavingNonPostEntityChanges:\n\t\t\t\t\tstore.isSavingNonPostEntityChanges(),\n\t\t\t\tisScheduled: store.isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\t!! store.getCurrentPost()?._links?.[ 'wp:action-publish' ],\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: store.getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! store.getPostEdits()?.status,\n\t\t\t\tpostType: store.getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Attachments don't support draft mode, so hide this button.\n\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.\n\t// The reason for this is that this button handles the `save as pending` and `save draft` actions.\n\t// An exception for this is when the post has a custom status and there should be a way to save changes without\n\t// having to publish. This should be handled better in the future when custom statuses have better support.\n\t// @see https://github.com/WordPress/gutenberg/issues/3144.\n\tconst isIneligibleStatus =\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&\n\t\tSTATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\tisIneligibleStatus ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled =\n\t\tisSaving ||\n\t\tisSaved ||\n\t\t! isSaveable ||\n\t\tisSavingLocked ||\n\t\t// Disable while a non-post entity (e.g. a newly created term) is mid-save.\n\t\tisSavingNonPostEntityChanges;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC,iCAAiC;AAAA,EACjC;AAAA,OACM;AACP,SAAS,aAAa,wBAAwB;AAC9C,SAAS,aAAa,iBAAiB;AACvC,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU;AACnB,SAAS,MAAM,OAAO,OAAO,mBAAmB;AAChD,SAAS,uBAAuB;AAChC,SAAS,SAAS,wBAAwB;AAK1C,SAAS,sBAAsB;AAC/B,SAAS,SAAS,mBAAmB;AACrC,SAAS,4BAA4B;AAqInC,SA2BmB,KA3BnB;AA1Ha,S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SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAO,kBAAkB,SAAY;AAAA,MACrC,OAAQ,QAAQ;AAAA,MAChB,iBAAgB;AAAA,MAEd;AAAA,wBAAgB,oBAAC,QAAK,MAAO,UAAU,QAAQ,OAAQ;AAAA,QACvD;AAAA;AAAA;AAAA,EACH;AAEF;",
6
6
  "names": []
7
7
  }
@@ -21,7 +21,7 @@ function getFullPostScheduleLabel(dateAttribute) {
21
21
  const timezoneAbbreviation = getTimezoneAbbreviation();
22
22
  const formattedDate = dateI18n(
23
23
  // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
24
- _x("F j, Y g:i\xA0a", "post schedule full date format"),
24
+ _x("F j, Y g:i a", "post schedule full date format"),
25
25
  date
26
26
  );
27
27
  return isRTL() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
@@ -39,7 +39,7 @@ function getPostScheduleLabel(dateAttribute, { isFloating = false, now = /* @__P
39
39
  // translators: %s: Time of day the post is scheduled for.
40
40
  __("Today at %s"),
41
41
  // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
42
- dateI18n(_x("g:i\xA0a", "post schedule time format"), date)
42
+ dateI18n(_x("g:i a", "post schedule time format"), date)
43
43
  );
44
44
  }
45
45
  const tomorrow = new Date(now);
@@ -49,19 +49,19 @@ function getPostScheduleLabel(dateAttribute, { isFloating = false, now = /* @__P
49
49
  // translators: %s: Time of day the post is scheduled for.
50
50
  __("Tomorrow at %s"),
51
51
  // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
52
- dateI18n(_x("g:i\xA0a", "post schedule time format"), date)
52
+ dateI18n(_x("g:i a", "post schedule time format"), date)
53
53
  );
54
54
  }
55
55
  if (date.getFullYear() === now.getFullYear()) {
56
56
  return dateI18n(
57
57
  // translators: If using a space between 'g:i' and 'a', use a non-breaking space.
58
- _x("F j g:i\xA0a", "post schedule date format without year"),
58
+ _x("F j g:i a", "post schedule date format without year"),
59
59
  date
60
60
  );
61
61
  }
62
62
  return dateI18n(
63
63
  // translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
64
- _x("F j, Y g:i\xA0a", "post schedule full date format"),
64
+ _x("F j, Y g:i a", "post schedule full date format"),
65
65
  date
66
66
  );
67
67
  }