@wordpress/editor 14.42.0 → 14.43.1-next.v.202604091042.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 (276) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +8 -0
  3. package/build/components/autocompleters/index.cjs +3 -0
  4. package/build/components/autocompleters/index.cjs.map +2 -2
  5. package/build/components/autocompleters/link.cjs +71 -0
  6. package/build/components/autocompleters/link.cjs.map +7 -0
  7. package/build/components/collaborators-overlay/cursor-dom-utils.cjs +1 -1
  8. package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +2 -2
  9. package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
  10. package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
  11. package/build/components/collaborators-overlay/index.cjs +7 -2
  12. package/build/components/collaborators-overlay/index.cjs.map +2 -2
  13. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
  14. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +2 -2
  15. package/build/components/collaborators-overlay/overlay.cjs +31 -1
  16. package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
  17. package/build/components/collaborators-overlay/timing-utils.cjs +1 -1
  18. package/build/components/collaborators-overlay/timing-utils.cjs.map +2 -2
  19. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +2 -2
  20. package/build/components/collaborators-presence/index.cjs +14 -4
  21. package/build/components/collaborators-presence/index.cjs.map +2 -2
  22. package/build/components/collaborators-presence/list.cjs +20 -4
  23. package/build/components/collaborators-presence/list.cjs.map +2 -2
  24. package/build/components/error-boundary/index.cjs +1 -1
  25. package/build/components/error-boundary/index.cjs.map +2 -2
  26. package/build/components/post-card-panel/index.cjs +4 -15
  27. package/build/components/post-card-panel/index.cjs.map +2 -2
  28. package/build/components/post-content-information/index.cjs +10 -13
  29. package/build/components/post-content-information/index.cjs.map +2 -2
  30. package/build/components/post-revisions-panel/index.cjs +164 -0
  31. package/build/components/post-revisions-panel/index.cjs.map +7 -0
  32. package/build/components/post-revisions-preview/revisions-slider.cjs +23 -12
  33. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  34. package/build/components/post-template/create-new-template-modal.cjs +39 -46
  35. package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
  36. package/build/components/post-template/hooks.cjs +52 -6
  37. package/build/components/post-template/hooks.cjs.map +2 -2
  38. package/build/components/post-template/swap-template-button.cjs +31 -20
  39. package/build/components/post-template/swap-template-button.cjs.map +2 -2
  40. package/build/components/post-title/index.cjs +2 -2
  41. package/build/components/post-title/index.cjs.map +2 -2
  42. package/build/components/preferences-modal/index.cjs +35 -27
  43. package/build/components/preferences-modal/index.cjs.map +2 -2
  44. package/build/components/revision-block-diff/index.cjs +9 -32
  45. package/build/components/revision-block-diff/index.cjs.map +3 -3
  46. package/build/components/revision-diff-panel/index.cjs +68 -0
  47. package/build/components/revision-diff-panel/index.cjs.map +7 -0
  48. package/build/components/revision-fields-diff/index.cjs +96 -0
  49. package/build/components/revision-fields-diff/index.cjs.map +7 -0
  50. package/build/components/sidebar/dataform-post-summary.cjs +8 -53
  51. package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
  52. package/build/components/sidebar/index.cjs +25 -22
  53. package/build/components/sidebar/index.cjs.map +3 -3
  54. package/build/components/sidebar/post-revision-summary.cjs +74 -0
  55. package/build/components/sidebar/post-revision-summary.cjs.map +7 -0
  56. package/build/components/sidebar/post-summary.cjs +35 -42
  57. package/build/components/sidebar/post-summary.cjs.map +3 -3
  58. package/build/components/style-book/index.cjs +4 -3
  59. package/build/components/style-book/index.cjs.map +2 -2
  60. package/build/components/styles-canvas/revisions.cjs +2 -2
  61. package/build/components/styles-canvas/revisions.cjs.map +1 -1
  62. package/build/components/sync-connection-error-modal/index.cjs +58 -75
  63. package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
  64. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +32 -9
  65. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +2 -2
  66. package/build/components/template-actions-panel/block-theme-content.cjs +188 -0
  67. package/build/components/template-actions-panel/block-theme-content.cjs.map +7 -0
  68. package/build/components/template-actions-panel/classic-theme-content.cjs +159 -0
  69. package/build/components/template-actions-panel/classic-theme-content.cjs.map +7 -0
  70. package/build/components/template-actions-panel/index.cjs +59 -0
  71. package/build/components/template-actions-panel/index.cjs.map +7 -0
  72. package/build/dataviews/store/private-actions.cjs +2 -0
  73. package/build/dataviews/store/private-actions.cjs.map +2 -2
  74. package/build/hooks/default-autocompleters.cjs +1 -1
  75. package/build/hooks/default-autocompleters.cjs.map +2 -2
  76. package/build/store/private-actions.cjs +15 -1
  77. package/build/store/private-actions.cjs.map +2 -2
  78. package/build/store/private-selectors.cjs +42 -19
  79. package/build/store/private-selectors.cjs.map +2 -2
  80. package/build/store/reducer.cjs +1 -1
  81. package/build/store/reducer.cjs.map +2 -2
  82. package/build-module/components/autocompleters/index.mjs +4 -2
  83. package/build-module/components/autocompleters/index.mjs.map +2 -2
  84. package/build-module/components/autocompleters/link.mjs +40 -0
  85. package/build-module/components/autocompleters/link.mjs.map +7 -0
  86. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +1 -1
  87. package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +2 -2
  88. package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
  89. package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
  90. package/build-module/components/collaborators-overlay/index.mjs +7 -2
  91. package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
  92. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
  93. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +2 -2
  94. package/build-module/components/collaborators-overlay/overlay.mjs +32 -2
  95. package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
  96. package/build-module/components/collaborators-overlay/timing-utils.mjs +1 -1
  97. package/build-module/components/collaborators-overlay/timing-utils.mjs.map +2 -2
  98. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  99. package/build-module/components/collaborators-presence/index.mjs +14 -4
  100. package/build-module/components/collaborators-presence/index.mjs.map +2 -2
  101. package/build-module/components/collaborators-presence/list.mjs +20 -4
  102. package/build-module/components/collaborators-presence/list.mjs.map +2 -2
  103. package/build-module/components/error-boundary/index.mjs +1 -1
  104. package/build-module/components/error-boundary/index.mjs.map +2 -2
  105. package/build-module/components/post-card-panel/index.mjs +6 -17
  106. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  107. package/build-module/components/post-content-information/index.mjs +6 -13
  108. package/build-module/components/post-content-information/index.mjs.map +2 -2
  109. package/build-module/components/post-revisions-panel/index.mjs +139 -0
  110. package/build-module/components/post-revisions-panel/index.mjs.map +7 -0
  111. package/build-module/components/post-revisions-preview/revisions-slider.mjs +23 -12
  112. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  113. package/build-module/components/post-template/create-new-template-modal.mjs +39 -46
  114. package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
  115. package/build-module/components/post-template/hooks.mjs +53 -7
  116. package/build-module/components/post-template/hooks.mjs.map +2 -2
  117. package/build-module/components/post-template/swap-template-button.mjs +27 -20
  118. package/build-module/components/post-template/swap-template-button.mjs.map +2 -2
  119. package/build-module/components/post-title/index.mjs +2 -2
  120. package/build-module/components/post-title/index.mjs.map +2 -2
  121. package/build-module/components/preferences-modal/index.mjs +35 -27
  122. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  123. package/build-module/components/revision-block-diff/index.mjs +9 -32
  124. package/build-module/components/revision-block-diff/index.mjs.map +2 -2
  125. package/build-module/components/revision-diff-panel/index.mjs +37 -0
  126. package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
  127. package/build-module/components/revision-fields-diff/index.mjs +65 -0
  128. package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
  129. package/build-module/components/sidebar/dataform-post-summary.mjs +8 -53
  130. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  131. package/build-module/components/sidebar/index.mjs +25 -22
  132. package/build-module/components/sidebar/index.mjs.map +2 -2
  133. package/build-module/components/sidebar/post-revision-summary.mjs +43 -0
  134. package/build-module/components/sidebar/post-revision-summary.mjs.map +7 -0
  135. package/build-module/components/sidebar/post-summary.mjs +31 -42
  136. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  137. package/build-module/components/style-book/index.mjs +4 -3
  138. package/build-module/components/style-book/index.mjs.map +2 -2
  139. package/build-module/components/styles-canvas/revisions.mjs +2 -2
  140. package/build-module/components/styles-canvas/revisions.mjs.map +1 -1
  141. package/build-module/components/sync-connection-error-modal/index.mjs +58 -76
  142. package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
  143. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +33 -10
  144. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +2 -2
  145. package/build-module/components/template-actions-panel/block-theme-content.mjs +167 -0
  146. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +7 -0
  147. package/build-module/components/template-actions-panel/classic-theme-content.mjs +138 -0
  148. package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +7 -0
  149. package/build-module/components/template-actions-panel/index.mjs +28 -0
  150. package/build-module/components/template-actions-panel/index.mjs.map +7 -0
  151. package/build-module/dataviews/store/private-actions.mjs +5 -1
  152. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  153. package/build-module/hooks/default-autocompleters.mjs +2 -2
  154. package/build-module/hooks/default-autocompleters.mjs.map +2 -2
  155. package/build-module/store/private-actions.mjs +15 -1
  156. package/build-module/store/private-actions.mjs.map +2 -2
  157. package/build-module/store/private-selectors.mjs +42 -19
  158. package/build-module/store/private-selectors.mjs.map +2 -2
  159. package/build-module/store/reducer.mjs +1 -1
  160. package/build-module/store/reducer.mjs.map +2 -2
  161. package/build-style/style-rtl.css +124 -44
  162. package/build-style/style.css +124 -44
  163. package/build-types/bindings/post-data.d.ts +3 -3
  164. package/build-types/bindings/term-data.d.ts +14 -14
  165. package/build-types/components/autocompleters/index.d.ts +1 -0
  166. package/build-types/components/autocompleters/link.d.ts +12 -0
  167. package/build-types/components/autocompleters/link.d.ts.map +1 -0
  168. package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
  169. package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
  170. package/build-types/components/collaborators-overlay/index.d.ts +7 -4
  171. package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
  172. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +1 -1
  173. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -1
  174. package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
  175. package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
  176. package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
  177. package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
  178. package/build-types/components/collaborators-presence/list.d.ts +4 -1
  179. package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
  180. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +11 -11
  181. package/build-types/components/post-actions/set-as-homepage.d.ts +1 -1
  182. package/build-types/components/post-actions/set-as-posts-page.d.ts +1 -1
  183. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  184. package/build-types/components/post-content-information/index.d.ts +4 -1
  185. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  186. package/build-types/components/post-format/index.d.ts +10 -10
  187. package/build-types/components/post-locked-modal/index.d.ts +2 -2
  188. package/build-types/components/post-revisions-panel/index.d.ts +2 -0
  189. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
  190. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  191. package/build-types/components/post-status/index.d.ts +10 -10
  192. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  193. package/build-types/components/post-template/hooks.d.ts +1 -1
  194. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  195. package/build-types/components/post-template/swap-template-button.d.ts +4 -0
  196. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  197. package/build-types/components/post-visibility/utils.d.ts +6 -6
  198. package/build-types/components/revision-block-diff/index.d.ts.map +1 -1
  199. package/build-types/components/revision-diff-panel/index.d.ts +14 -0
  200. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
  201. package/build-types/components/revision-fields-diff/index.d.ts +6 -0
  202. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
  203. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  204. package/build-types/components/sidebar/index.d.ts.map +1 -1
  205. package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
  206. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
  207. package/build-types/components/sidebar/post-summary.d.ts +3 -0
  208. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  209. package/build-types/components/style-book/index.d.ts +2 -1
  210. package/build-types/components/style-book/index.d.ts.map +1 -1
  211. package/build-types/components/sync-connection-error-modal/index.d.ts +0 -14
  212. package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
  213. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -1
  214. package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
  215. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
  216. package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
  217. package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
  218. package/build-types/components/template-actions-panel/index.d.ts +2 -0
  219. package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
  220. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  221. package/build-types/store/private-actions.d.ts.map +1 -1
  222. package/build-types/store/private-selectors.d.ts.map +1 -1
  223. package/build-types/store/reducer.d.ts +10 -10
  224. package/build-types/store/reducer.d.ts.map +1 -1
  225. package/build-types/utils/pageTypeBadge.d.ts +1 -1
  226. package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
  227. package/package.json +45 -44
  228. package/src/components/autocompleters/index.js +1 -0
  229. package/src/components/autocompleters/link.js +47 -0
  230. package/src/components/autocompleters/style.scss +6 -0
  231. package/src/components/collaborators-overlay/cursor-dom-utils.ts +1 -1
  232. package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
  233. package/src/components/collaborators-overlay/index.tsx +12 -4
  234. package/src/components/collaborators-overlay/overlay-iframe-styles.ts +1 -1
  235. package/src/components/collaborators-overlay/overlay.tsx +45 -1
  236. package/src/components/collaborators-overlay/timing-utils.ts +1 -1
  237. package/src/components/collaborators-overlay/use-render-cursors.ts +4 -2
  238. package/src/components/collaborators-presence/index.tsx +9 -1
  239. package/src/components/collaborators-presence/list.tsx +25 -1
  240. package/src/components/error-boundary/index.js +1 -1
  241. package/src/components/error-boundary/index.native.js +1 -1
  242. package/src/components/post-card-panel/index.js +7 -21
  243. package/src/components/post-content-information/index.js +5 -16
  244. package/src/components/post-revisions-panel/index.js +151 -0
  245. package/src/components/post-revisions-panel/style.scss +16 -0
  246. package/src/components/post-revisions-preview/revisions-slider.js +23 -19
  247. package/src/components/post-template/create-new-template-modal.js +1 -4
  248. package/src/components/post-template/hooks.js +65 -9
  249. package/src/components/post-template/style.scss +0 -6
  250. package/src/components/post-template/swap-template-button.js +30 -21
  251. package/src/components/post-title/index.js +3 -3
  252. package/src/components/preferences-modal/index.js +37 -25
  253. package/src/components/revision-block-diff/index.js +8 -43
  254. package/src/components/revision-diff-panel/index.js +59 -0
  255. package/src/components/revision-fields-diff/index.js +91 -0
  256. package/src/components/sidebar/dataform-post-summary.js +8 -55
  257. package/src/components/sidebar/index.js +33 -22
  258. package/src/components/sidebar/post-revision-summary.js +50 -0
  259. package/src/components/sidebar/post-summary.js +22 -40
  260. package/src/components/sidebar/style.scss +7 -0
  261. package/src/components/style-book/index.js +4 -2
  262. package/src/components/styles-canvas/revisions.js +2 -2
  263. package/src/components/sync-connection-error-modal/index.tsx +128 -155
  264. package/src/components/sync-connection-error-modal/use-retry-countdown.ts +46 -10
  265. package/src/components/template-actions-panel/block-theme-content.js +196 -0
  266. package/src/components/template-actions-panel/classic-theme-content.js +170 -0
  267. package/src/components/template-actions-panel/index.js +32 -0
  268. package/src/components/template-actions-panel/style.scss +39 -0
  269. package/src/dataviews/store/private-actions.ts +6 -0
  270. package/src/hooks/default-autocompleters.js +2 -2
  271. package/src/hooks/test/default-autocompleters.js +2 -2
  272. package/src/store/private-actions.js +18 -2
  273. package/src/store/private-selectors.js +43 -22
  274. package/src/store/reducer.js +9 -8
  275. package/src/style.scss +3 -1
  276. /package/src/components/{revision-block-diff → revision-diff-panel}/style.scss +0 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { PanelBody } from '@wordpress/components';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostPanelRow from '../post-panel-row';
10
+
11
+ /**
12
+ * Renders a panel of word-level diffs.
13
+ *
14
+ * @param {Object} props
15
+ * @param {string} props.title Panel title.
16
+ * @param {Object} props.entries Map of key → diffWords parts arrays.
17
+ * @param {boolean} props.initialOpen Whether the panel starts open.
18
+ */
19
+ export default function RevisionDiffPanel( { title, entries, initialOpen } ) {
20
+ if ( ! entries ) {
21
+ return null;
22
+ }
23
+
24
+ const fields = Object.entries( entries ).map( ( [ key, parts ] ) => (
25
+ <PostPanelRow key={ key } label={ key }>
26
+ <span className="editor-revision-fields-diff__value">
27
+ { parts.map( ( part, index ) => {
28
+ if ( part.added ) {
29
+ return (
30
+ <ins
31
+ key={ index }
32
+ className="editor-revision-fields-diff__added"
33
+ >
34
+ { part.value }
35
+ </ins>
36
+ );
37
+ }
38
+ if ( part.removed ) {
39
+ return (
40
+ <del
41
+ key={ index }
42
+ className="editor-revision-fields-diff__removed"
43
+ >
44
+ { part.value }
45
+ </del>
46
+ );
47
+ }
48
+ return <span key={ index }>{ part.value }</span>;
49
+ } ) }
50
+ </span>
51
+ </PostPanelRow>
52
+ ) );
53
+
54
+ return (
55
+ <PanelBody title={ title } initialOpen={ initialOpen }>
56
+ { fields }
57
+ </PanelBody>
58
+ );
59
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { diffWords } from 'diff/lib/diff/word';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useSelect } from '@wordpress/data';
10
+ import { useMemo } from '@wordpress/element';
11
+ import { __ } from '@wordpress/i18n';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import RevisionDiffPanel from '../revision-diff-panel';
17
+ import { store as editorStore } from '../../store';
18
+ import { unlock } from '../../lock-unlock';
19
+
20
+ /**
21
+ * Safely stringifies a value for display and comparison.
22
+ *
23
+ * @param {*} value The value to stringify.
24
+ * @return {string} The stringified value.
25
+ */
26
+ function stringifyValue( value ) {
27
+ if ( value === null || value === undefined ) {
28
+ return '';
29
+ }
30
+ if ( typeof value === 'object' ) {
31
+ return JSON.stringify( value, null, 2 );
32
+ }
33
+ return String( value );
34
+ }
35
+
36
+ /**
37
+ * Panel that shows meta field diffs between the current revision and
38
+ * the previous revision in the document sidebar during revision mode.
39
+ */
40
+ export default function RevisionFieldsDiffPanel() {
41
+ const { revision, previousRevision } = useSelect( ( select ) => {
42
+ const { getCurrentRevision, getPreviousRevision } = unlock(
43
+ select( editorStore )
44
+ );
45
+
46
+ return {
47
+ revision: getCurrentRevision(),
48
+ previousRevision: getPreviousRevision(),
49
+ };
50
+ }, [] );
51
+
52
+ const entries = useMemo( () => {
53
+ if ( ! revision ) {
54
+ return null;
55
+ }
56
+
57
+ const revisionMeta = revision.meta ?? {};
58
+ const previousMeta = previousRevision?.meta ?? {};
59
+ const allMetaKeys = new Set( [
60
+ ...Object.keys( revisionMeta ),
61
+ ...Object.keys( previousMeta ),
62
+ ] );
63
+
64
+ const result = {};
65
+
66
+ for ( const key of allMetaKeys ) {
67
+ const revStr = stringifyValue( revisionMeta[ key ] );
68
+ const prevStr = stringifyValue( previousMeta[ key ] );
69
+
70
+ if ( ! revStr && ! prevStr ) {
71
+ continue;
72
+ }
73
+
74
+ result[ key ] = diffWords( prevStr, revStr );
75
+ }
76
+
77
+ if ( Object.keys( result ).length === 0 ) {
78
+ return null;
79
+ }
80
+
81
+ return result;
82
+ }, [ revision, previousRevision ] );
83
+
84
+ return (
85
+ <RevisionDiffPanel
86
+ title={ __( 'Meta' ) }
87
+ entries={ entries }
88
+ initialOpen={ false }
89
+ />
90
+ );
91
+ }
@@ -7,6 +7,7 @@ import { store as coreDataStore } from '@wordpress/core-data';
7
7
  import { DataForm } from '@wordpress/dataviews';
8
8
  import { __experimentalVStack as VStack } from '@wordpress/components';
9
9
  import { useMemo } from '@wordpress/element';
10
+ import { useViewConfig } from '@wordpress/views';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -16,70 +17,23 @@ import PostPanelSection from '../post-panel-section';
16
17
  import { store as editorStore } from '../../store';
17
18
  import PostTrash from '../post-trash';
18
19
  import usePostFields from '../post-fields';
19
- import { unlock } from '../../lock-unlock';
20
20
  import { usePostTemplatePanelMode } from '../post-template/hooks';
21
21
 
22
- const form = {
23
- layout: {
24
- type: 'panel',
25
- },
26
- fields: [
27
- {
28
- id: 'featured_media',
29
- layout: {
30
- type: 'regular',
31
- labelPosition: 'none',
32
- },
33
- },
34
- {
35
- id: 'post-content-info',
36
- layout: {
37
- type: 'regular',
38
- labelPosition: 'none',
39
- },
40
- },
41
- {
42
- id: 'status',
43
- label: __( 'Status' ),
44
- children: [
45
- {
46
- id: 'status',
47
- layout: { type: 'regular', labelPosition: 'none' },
48
- },
49
- 'password',
50
- ],
51
- },
52
- 'date',
53
- 'slug',
54
- 'author',
55
- 'template',
56
- {
57
- id: 'discussion',
58
- label: __( 'Discussion' ),
59
- children: [
60
- {
61
- id: 'comment_status',
62
- layout: { type: 'regular', labelPosition: 'none' },
63
- },
64
- 'ping_status',
65
- ],
66
- },
67
- 'parent',
68
- 'format',
69
- ],
70
- };
22
+ const EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };
71
23
 
72
24
  export default function DataFormPostSummary( { onActionPerformed } ) {
73
25
  const { postType, postId } = useSelect( ( select ) => {
74
- const { getCurrentPostType, getCurrentPostId } = unlock(
75
- select( editorStore )
76
- );
26
+ const { getCurrentPostType, getCurrentPostId } = select( editorStore );
77
27
  return {
78
28
  postType: getCurrentPostType(),
79
29
  postId: getCurrentPostId(),
80
30
  };
81
31
  }, [] );
82
-
32
+ const { form: formConfig } = useViewConfig( {
33
+ kind: 'postType',
34
+ name: postType,
35
+ } );
36
+ const form = formConfig ?? EMPTY_FORM;
83
37
  const record = useSelect(
84
38
  ( select ) => {
85
39
  if ( ! postType || ! postId ) {
@@ -172,7 +126,6 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
172
126
 
173
127
  editEntityRecord( 'postType', postType, postId, edits );
174
128
  };
175
-
176
129
  return (
177
130
  <PostPanelSection className="editor-post-summary">
178
131
  <VStack spacing={ 4 }>
@@ -26,12 +26,15 @@ import PatternOverridesPanel from '../pattern-overrides-panel';
26
26
  import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
27
27
  import PluginSidebar from '../plugin-sidebar';
28
28
  import PostSummary from './post-summary';
29
+ import PostRevisionSummary from './post-revision-summary';
29
30
  import PostTaxonomiesPanel from '../post-taxonomies/panel';
30
31
  import PostTransformPanel from '../post-transform-panel';
31
32
  import SidebarHeader from './header';
33
+ import TemplateActionsPanel from '../template-actions-panel';
32
34
  import TemplateContentPanel from '../template-content-panel';
33
35
  import TemplatePartContentPanel from '../template-part-content-panel';
34
36
  import { MediaMetadataPanel } from '../media';
37
+ import PostRevisionsPanel from '../post-revisions-panel';
35
38
  import RevisionBlockDiffPanel from '../revision-block-diff';
36
39
  import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
37
40
  import { sidebars } from './constants';
@@ -95,6 +98,35 @@ const SidebarContent = ( {
95
98
  }
96
99
  }, [ tabName ] );
97
100
 
101
+ let tabContent;
102
+ if ( isAttachment ) {
103
+ tabContent = (
104
+ <MediaMetadataPanel onActionPerformed={ onActionPerformed } />
105
+ );
106
+ } else if ( isRevisionsMode ) {
107
+ tabContent = <PostRevisionSummary />;
108
+ } else {
109
+ tabContent = (
110
+ <>
111
+ <PostSummary onActionPerformed={ onActionPerformed } />
112
+ <PluginDocumentSettingPanel.Slot />
113
+ <TemplateContentPanel />
114
+ { window?.__experimentalDataFormInspector &&
115
+ [ 'post', 'page' ].includes( postType ) && (
116
+ <>
117
+ <TemplateActionsPanel />
118
+ <PostRevisionsPanel />
119
+ </>
120
+ ) }
121
+ <TemplatePartContentPanel />
122
+ <PostTransformPanel />
123
+ <PostTaxonomiesPanel />
124
+ <PatternOverridesPanel />
125
+ { extraPanels }
126
+ </>
127
+ );
128
+ }
129
+
98
130
  return (
99
131
  <PluginSidebar
100
132
  identifier={ tabName }
@@ -119,28 +151,7 @@ const SidebarContent = ( {
119
151
  >
120
152
  <Tabs.Context.Provider value={ tabsContextValue }>
121
153
  <Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
122
- { isAttachment ? (
123
- <MediaMetadataPanel
124
- onActionPerformed={ onActionPerformed }
125
- />
126
- ) : (
127
- <>
128
- <PostSummary
129
- onActionPerformed={ onActionPerformed }
130
- />
131
- { ! isRevisionsMode && (
132
- <>
133
- <PluginDocumentSettingPanel.Slot />
134
- <TemplateContentPanel />
135
- <TemplatePartContentPanel />
136
- <PostTransformPanel />
137
- <PostTaxonomiesPanel />
138
- <PatternOverridesPanel />
139
- { extraPanels }
140
- </>
141
- ) }
142
- </>
143
- ) }
154
+ { tabContent }
144
155
  </Tabs.TabPanel>
145
156
  { ! isAttachment && (
146
157
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
@@ -0,0 +1,50 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { __experimentalVStack as VStack } from '@wordpress/components';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as editorStore } from '../../store';
11
+ import { unlock } from '../../lock-unlock';
12
+ import RevisionAuthorPanel from '../revision-author-panel';
13
+ import RevisionCreatedPanel from '../revision-created-panel';
14
+ import { PostContentInformationUI } from '../post-content-information';
15
+ import RevisionFieldsDiffPanel from '../revision-fields-diff';
16
+ import PostPanelSection from '../post-panel-section';
17
+ import PostCardPanel from '../post-card-panel';
18
+ import { OpenRevisionsClassicScreen } from './post-summary';
19
+
20
+ export default function PostRevisionSummary() {
21
+ const { revisionId, postId, postContent } = useSelect( ( select ) => {
22
+ const { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } =
23
+ unlock( select( editorStore ) );
24
+ const _revisionId = getCurrentRevisionId();
25
+ return {
26
+ revisionId: _revisionId,
27
+ postId: getCurrentPostId(),
28
+ postContent: _revisionId && getCurrentRevision()?.content?.raw,
29
+ };
30
+ }, [] );
31
+ if ( ! revisionId ) {
32
+ return null;
33
+ }
34
+ return (
35
+ <>
36
+ <PostPanelSection className="editor-post-summary">
37
+ <VStack spacing={ 4 }>
38
+ <PostCardPanel postId={ postId } hideActions />
39
+ <VStack spacing={ 1 }>
40
+ <PostContentInformationUI postContent={ postContent } />
41
+ <RevisionCreatedPanel />
42
+ </VStack>
43
+ <OpenRevisionsClassicScreen revisionId={ revisionId } />
44
+ <RevisionAuthorPanel />
45
+ </VStack>
46
+ </PostPanelSection>
47
+ <RevisionFieldsDiffPanel />
48
+ </>
49
+ );
50
+ }
@@ -23,7 +23,6 @@ import { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/pan
23
23
  import PostFeaturedImagePanel from '../post-featured-image/panel';
24
24
  import PostFormatPanel from '../post-format/panel';
25
25
  import PostLastEditedPanel from '../post-last-edited-panel';
26
- import RevisionCreatedPanel from '../revision-created-panel';
27
26
  import PostPanelSection from '../post-panel-section';
28
27
  import PostSchedulePanel from '../post-schedule/panel';
29
28
  import PostStatusPanel from '../post-status';
@@ -36,14 +35,24 @@ import SiteDiscussion from '../site-discussion';
36
35
  import { store as editorStore } from '../../store';
37
36
  import { PrivatePostLastRevision } from '../post-last-revision';
38
37
  import PostTrash from '../post-trash';
39
- import RevisionAuthorPanel from '../revision-author-panel';
40
- import { unlock } from '../../lock-unlock';
41
38
 
42
39
  /**
43
40
  * Module Constants
44
41
  */
45
42
  const PANEL_NAME = 'post-status';
46
43
 
44
+ export function OpenRevisionsClassicScreen( { revisionId } ) {
45
+ return (
46
+ <ExternalLink
47
+ href={ addQueryArgs( 'revision.php', {
48
+ revision: revisionId,
49
+ } ) }
50
+ >
51
+ { __( 'Open classic revisions screen' ) }
52
+ </ExternalLink>
53
+ );
54
+ }
55
+
47
56
  export default function PostSummary( { onActionPerformed } ) {
48
57
  const postType = useSelect(
49
58
  ( select ) => select( editorStore ).getCurrentPostType(),
@@ -59,28 +68,23 @@ export default function PostSummary( { onActionPerformed } ) {
59
68
  }
60
69
 
61
70
  function ClassicPostSummary( { onActionPerformed } ) {
62
- const { isRemovedPostStatusPanel, postType, postId, revisionId } =
63
- useSelect( ( select ) => {
71
+ const { isRemovedPostStatusPanel, postType, postId } = useSelect(
72
+ ( select ) => {
64
73
  // We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do
65
74
  // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
66
75
  const {
67
76
  isEditorPanelRemoved,
68
77
  getCurrentPostType,
69
78
  getCurrentPostId,
70
- getCurrentRevisionId,
71
- } = unlock( select( editorStore ) );
79
+ } = select( editorStore );
72
80
  return {
73
81
  isRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),
74
82
  postType: getCurrentPostType(),
75
83
  postId: getCurrentPostId(),
76
- revisionId: getCurrentRevisionId(),
77
84
  };
78
- }, [] );
79
-
80
- const isRevisionsMode = !! revisionId;
81
- const shouldShowPostStatusPanel =
82
- ! isRemovedPostStatusPanel && ! isRevisionsMode;
83
-
85
+ },
86
+ []
87
+ );
84
88
  return (
85
89
  <PostPanelSection className="editor-post-summary">
86
90
  <PluginPostStatusInfo.Slot>
@@ -92,35 +96,13 @@ function ClassicPostSummary( { onActionPerformed } ) {
92
96
  postId={ postId }
93
97
  onActionPerformed={ onActionPerformed }
94
98
  />
95
- { ! isRevisionsMode && (
96
- <PostFeaturedImagePanel
97
- withPanelBody={ false }
98
- />
99
- ) }
100
- { ! isRevisionsMode && <PostExcerptPanel /> }
99
+ <PostFeaturedImagePanel withPanelBody={ false } />
100
+ <PostExcerptPanel />
101
101
  <VStack spacing={ 1 }>
102
102
  <PostContentInformation />
103
- { isRevisionsMode ? (
104
- <RevisionCreatedPanel />
105
- ) : (
106
- <PostLastEditedPanel />
107
- ) }
103
+ <PostLastEditedPanel />
108
104
  </VStack>
109
- { isRevisionsMode && revisionId && (
110
- <>
111
- <ExternalLink
112
- href={ addQueryArgs( 'revision.php', {
113
- revision: revisionId,
114
- } ) }
115
- >
116
- { __(
117
- 'Open classic revisions screen'
118
- ) }
119
- </ExternalLink>
120
- <RevisionAuthorPanel />
121
- </>
122
- ) }
123
- { shouldShowPostStatusPanel && (
105
+ { ! isRemovedPostStatusPanel && (
124
106
  <VStack spacing={ 4 }>
125
107
  <VStack spacing={ 1 }>
126
108
  <PostStatusPanel />
@@ -28,3 +28,10 @@
28
28
  font-size: $default-font-size;
29
29
  }
30
30
  }
31
+
32
+ // TODO: These styles should be absorbed by DataForm API.
33
+ // @see https://github.com/WordPress/gutenberg/issues/75916
34
+ .fields-controls__password {
35
+ border-top: $border-width solid $gray-200;
36
+ padding-top: $grid-unit-20;
37
+ }
@@ -375,6 +375,7 @@ function StyleBook(
375
375
  * @param {Function} props.onPathChange Callback when the path changes.
376
376
  * @param {Object} props.userConfig User configuration.
377
377
  * @param {boolean} props.isStatic Whether the stylebook is static or clickable.
378
+ * @param {Object} props.settings Optional editor settings to use instead of the editor store settings.
378
379
  * @return {Object} Style Book Preview component.
379
380
  */
380
381
  export const StyleBookPreview = ( {
@@ -382,10 +383,11 @@ export const StyleBookPreview = ( {
382
383
  isStatic = false,
383
384
  path,
384
385
  onPathChange,
386
+ settings: settingsProp,
385
387
  } ) => {
386
388
  const editorSettings = useSelect(
387
- ( select ) => select( editorStore ).getEditorSettings(),
388
- []
389
+ ( select ) => settingsProp ?? select( editorStore ).getEditorSettings(),
390
+ [ settingsProp ]
389
391
  );
390
392
 
391
393
  const canUserUploadMedia = useSelect(
@@ -23,7 +23,7 @@ import { unlock } from '../../lock-unlock';
23
23
 
24
24
  const {
25
25
  ExperimentalBlockEditorProvider,
26
- __unstableBlockStyleVariationOverridesWithConfig,
26
+ BlockStyleVariationOverridesWithConfig,
27
27
  } = unlock( blockEditorPrivateApis );
28
28
 
29
29
  function isObjectEmpty( object ) {
@@ -133,7 +133,7 @@ function StylesCanvasRevisions( { path }, ref ) {
133
133
  * so they can access any registered style overrides.
134
134
  */ }
135
135
  <EditorStyles styles={ editorStyles } />
136
- <__unstableBlockStyleVariationOverridesWithConfig
136
+ <BlockStyleVariationOverridesWithConfig
137
137
  config={ mergedConfig }
138
138
  />
139
139
  </ExperimentalBlockEditorProvider>